Two things:
First, it is more intuitive to treat gravitational force as equivalent to electrostatic force, due to the existence of monopoles (and gravitational field lines do not form closed loops). There is a magnetic analogue to gravity, known as gravetomagnetism, frame-dragging, or the Lense-Thirring effect.
Ok, now to answer your question:
Yes, gravitational fields are created by the "valley" mechanism. But, their method of transmission is through gravitational waves.
Imagine, for a moment, that someone instantaneously vaporized the sun. By vaporized, I mean that all the mass was just forced to disappear (note that this is hypothetical). Now, by our classical description, the Earth will change its trajectory immediately (as the net force changed). But the light from the vaporization will take some time to reach the Earth (8 minutes). So we managed to send a signal faster than light!
The flaw in the above situation is that gravity is transmitted by vibrations in the "rubber sheet" known as gravitational waves. Imagine the same situation in rubber-sheet mode. To make it a bit clearer, imagine a very large sheet with a small but massive sun at the center. Removing the sun will create a vibration that travels to the edge of the sheet. Till the vibration reaches the Earth, the Earth will feel that the sheet has not changed in its vicinity. Once the vibration reaches the Earth, it will be jerked onto its new "no force" path (after a brief period of stretching and squeezing).
Now, Electromagnetism is transmitted by electromagnetic waves. There aren't any rubber-sheet analogies for this, due to the repulsive-attractive duality. Basically, an EM wave like light propagates in one direction, and carries a mutually perpendicular set of electric and magnetic fields which oscillate (with the same frequency as the wave itself). A moving charge (for that matter, a stationary one, too) emits these waves, which interact with other charges in a similar way as above. The inverse square law here can be said to arise from the fact that the intensity of an EM wave is inversely proportional to the square of the distance (When the wave arises from a point source).
Note that this emission of EM waves does not violate conservation if energy, as the particle will also absorb EM waves from others.
The actual explanation for all this comes from quantum mechanics. I'll only show how the electrostatic repulsive force works here, as the attractive force is a bit more complicated to explain.
In quantum mechanics, in any region of space, even an empty one, "virtual" particles can be created and shortly destroyed. These particles are "virtual" as they do not behave normally.
Now, lets take two protons near each other (neglecting nuclear forces). Each proton "emits" virtual photons in all directions. Note that photons have momentum in quantum mechanics. Now, the proton would stay at rest if the second proton was not there, as net momentum change is zero (photons are being emitted in all directions. But, the proton is absorbing photons on one side from the other proton. So, these photons "push" the proton away from the other proton. The same thing happens to the other proton, and the net result is that the protons move away from each other.
To explain attractive force, you have to take into account that the photon has a wavefunction, and has no definite position or momentum. Thus, a photon coming from the left proton can actually hit the right proton from the right, creating an attractive force. So we have to balance the probabilities for this, and the equations involve the charges of the two bodies, this giving rise to the "like charges repel, opposites attract"
One more thing about electric and magnetic fields: They are actually the same thing. An observer moving at some speed will disagree as to which part of the field is electric and which part is magnetic (As magnetic forces involve velocities).