Hi,
I would like to validate form fields each time the user leaves the field (onblur event), instead of doing it at once, when the form is submited.
If something goes wring, a message should appear in an alert box, the bgcolor of the problematic field should be set to red and the focus should be set on the problematic field.
I tried to do it but I'm stuck on putting the focus. The validation works, the alert box is triggered, the bgcolor is changed but the focus is put on the next field, not on the problematic one, even if I write: fieldName.focus(); It does it with or without return false or return true.
Would anyone know how to keep the focus on the problematic field? Thanks in advance and cheers,
kobzar
I would like to validate form fields each time the user leaves the field (onblur event), instead of doing it at once, when the form is submited.
If something goes wring, a message should appear in an alert box, the bgcolor of the problematic field should be set to red and the focus should be set on the problematic field.
I tried to do it but I'm stuck on putting the focus. The validation works, the alert box is triggered, the bgcolor is changed but the focus is put on the next field, not on the problematic one, even if I write: fieldName.focus(); It does it with or without return false or return true.
Would anyone know how to keep the focus on the problematic field? Thanks in advance and cheers,
kobzar