Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp:controlvalidators - can you detect centrally if one has fired?

Status
Not open for further replies.

NoCoolHandle

Programmer
Apr 10, 2003
2,321
US
Hi..

I have a form that has mulitple textbox's that require validation.

To do this I had added a requiredfield validator to each of the needed textbox's.

What I can't seem to figure out, is that if someone clicks the "Submit" button, and a validator causes an error at the top of the form, how can you detect that at the "submit" (asp:button) that caused the event to fire and let someone know they need to correct something. Rather than assume that "nothing is happening" as they can't see the "[red]*[/red]".

I am thinking of just using ajax or adding validation via javascript or jquery, but if there is an easy way....

Thanks in advance


Rob
 
I am confused as to what is happening and what you want to do.

If you want to show a display at the top of the screen, use a validation summary control. Set all the validation controls and the button to the same validation group. Then the error message for each control will show in the summary control.
 
sounds like the problem is the user needs to scroll to enter all the fields. at the bottom of the form is the button, but the validation summary is at the top of the page. to know there are error messages you would need to scroll back up to the top.

you have a couple options.
1. add an anchor to the validation summary. when the submit button is clicked navigate to the anchor. this would take them to the top of the page.
2. break up the form into smaller chunks and have the user walk through each step. this removes the need to scroll, so you won't need any js tricks/hacks to go back up the screen.

ajax can create a better user experience, but I don't see how it would solve the scrolling problem.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top