views:

179

answers:

0

Hello,

Just started with jquery and am trying to get form validation to work using the validation plugin. Then I discovered the maskedinput plugin (http://digitalbush.com/projects/masked-input-plugin/) and tried to use it on a phone number field.

Things work to a point: When the phone field comes in focus it displays the place holders and allows you to enter a phone number and limits you to digits - very nice!

However, if you only enter 9 digits instead of the required 10 (assuming US phone number), yes, unlikely, but crazier stuff has and will happen, and you click submit, then anything that was already in the phone field is cleared. If you enter the entire phone number and validation fails on some other field the entry in the phone field sticks.

How can I prevent this?

Thanks hgg