Link to home
Start Free TrialLog in
Avatar of tidydave
tidydave

asked on

ASP.NET Form Validation Javascript - Set Focus to required field

hi,

i have had a look on google about this but couldn't find anything.

the situation is this... i have a large form with a number of required field validators on it.  there's a button at the bottom of form.  when it's clicked the form validation fires.  i've set up a validation summary to pop up an alert box containing the fields that require information.

however, what would be even better, would be to set the focus to the first field in the list, that requires information.  so the process would go:

1.  click button.
2.  validation summary show a pop up with a list of fields
     that require info.
3.  some extra javascript written by you guys, would set the
     focus to the first field in the pop up.

kind regards,
dave.


Avatar of glsac
glsac
Flag of United States of America image

Avatar of tidydave
tidydave

ASKER

thanks for the javascript.  however we have done it this way before.  what we want to do now, is add some javascript, to interact with the ASP.NET required field valiators AND/OR validation summary.  so that the element that is first in the validation summary list has focus.  it is an improvement on the current functionality.

cheers, dave :-)
ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial