Link to home
Start Free TrialLog in
Avatar of RTKHOT
RTKHOTFlag for India

asked on

RequiredFieldValidator issue

My web page has an online form with about 40 textbox fields placed one below the other. Each textbox has a RequiredFieldValidator attached to it which gives an error if the textbox is left empty.

Everything is working well. But the problem is that the submit button is at the bottom. If the user has left some textbox empty on the top, then the submit click wont work, but the user will not know since the textbox giving error is on top.

Is there anyway i can catch if any of the validators has given an error, then i could show a message near the submit button that some field above has been left empty.
Avatar of jayakrishnabh
jayakrishnabh

Validation summary control near to the submit button
Avatar of RTKHOT

ASKER

No. That give the error message of each field. I just want a common message such as "Please check all above items".

Validation summary gives the error message of each field. if the client has left all 40 textboxes empty, it will be a problem
OnClientClick call javascript function and set the common message of the error message holder near submit button if atleast one of the validation fails.
Avatar of RTKHOT

ASKER

and how do i check if any one validation has failed? does the validator control return anything that i can check?
Not through the validator, but from Textboxe's values as follows

if (document.getElementById("TextBox1").value.trim().length == 0 || document.getElementById("TextBox2").value.trim().length == 0
                || document.getElementById("TextBox3").value.trim().length == 0) {
                //Set the message here
            }
            return false;
ASKER CERTIFIED SOLUTION
Avatar of Alan Warren
Alan Warren
Flag of Philippines 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