|
-
July 17th, 2006, 05:02 PM
#1
Multiple validation on the click of the submit button
Hi all,
I am trying to validate the multiple controls, on click of the next button on the ASP Page. (Next Button is the server control).
In the validation of the multiple controls for example 3 textboxes
The user can enter the value in one text box or in two or in all of them or in none of them.
I want to validate, whether the user has entered the value in atleast one of them. And if yes, then only it should go to save the data and move to next page.
I have tried adding the javascript through add.attribute, it works but it goes for saving the data into the database and moves to next page.
I tried the customValidator control, but it doesnt work.
Can anybody help me in this? I am stuck with this and cant move ahead.
Any help will be appreciated.
Thank You
-
July 18th, 2006, 12:29 AM
#2
Re: Multiple validation on the click of the submit button
It should be easy using JavaScript. Can you post the Javascript code that you are using?
And what version of ASP.NET are you working on?
-
July 18th, 2006, 01:22 AM
#3
Re: Multiple validation on the click of the submit button
I got my mistake, i was calling javascript function only . But the way i was calling it was wrong.
Code ::
Initially i wrote code as ::
btnNext.Attirbutes.Add("OnClick", "ValidateValues()")
Where as the correct way is ::
btnNext.Attirbutes.Add("OnClick", "return ValidateValues()")
Thanks for your help.
Amit
-
July 18th, 2006, 01:28 AM
#4
Re: Multiple validation on the click of the submit button
Thats what I was also suspecting that you might not be returning the true/false back from the JS function.
Anyways, I am glad that you resolved your problem.
-
July 18th, 2006, 02:12 AM
#5
Re: Multiple validation on the click of the submit button
You could also overload the validator control and make your own, and then simply make your own isValid implementation. This way you can keep it to the asp.net validatiors and thus the same type of error messages et al. It is particular usefull if you have other asp:validators on the page as well, and it is relative simple for what you ask.
This would proberly have been the way I personally would do it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|