Does your washer constantly attempt to fill and never does? Or, does the washer continue to fill and overflow?
If the washer is constantly trying to fill, but your water level does not change, you may have a condition known as siphoning. Siphoning occurs when you don't have a proper air gap on the drain line and the washer will actually drain as it attempts to fill. The following link explains:
If your washer fills, won't shut off and then overflows, this is caused by either a pressure switch malfuction, or a water inlet valve that won't shut off. The following link explains how to diagnose the problem:
I know the link is for a problem where the washer continues to fill even when it is not in use, but this problem occurs while the washer is running as well. The method of determing the cause is the same. In many cases, an overflow problem is caused by the air hose slipping off the pressure switch. Without the air hose, the pressure switch never detects the pressure differntial from the wash tub as it fills and won't shut off.
Read through the links provided and let me know if you have any questions. If the conditions I have described do not match your symptoms, please post back and elaborate a bit more so I can help you determine the source of the problem. Please include your complete MODEL NUMBER. I hope you find this information helpful.