469,643 Members | 2,025 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Please help: Validating input from a combination of controls

Hi,

I'm developing a search facility for my web app. In order for the
search criteria to be valid the user must (a) enter some text in a
text box and check and least one checkbox (of which there are two)
and/or (b) select at least one item from a multiple select list box.
I've written the javascript to do the client side validation which
gets called on the click event of my search button. I'd like to
implement server side validation using the validation controls but am
not sure how to achieve this. Can the custom validation control be
used in this instance (i.e. to validate the input from multiple
controls). If so how?

Thanks,

Paul
Nov 18 '05 #1
1 1369
Yes, a CustomValidator can be built to describe the same logic on the server
side as on the client side. The trick is to avoid having it valid except
when this particular button is pressed. In this case, I'd avoid using the
Page.Validate() method which is automically called when the submit button's
CausesValidation = true. Instead, I'd hook up that button's Click event
handler and have it call Validate() on the CustomValidator. Set the button's
CausesValidation to false. If CustomValidator.IsValid is false, regenerate
the page without saving data.

This scenerio is a very common one that requires something called
"Validation Groups". ASP.NET 2.0 (Whidbey) will eventually have this
feature. In the meantime, I offer a commercial product that supports
Validation Groups and building the extensive logical case you describe
without coding. In fact, with my validators, it will generate the correct
JavaScript for you and it will work on IE, IE/Mac, Netscape 6+, Mozilla,
Opera 7 and Safari (whereas Microsoft's client-side validation is IE
specific.) My product is "Professional Validation And More". Learn more at
http://www.peterblum.com/vam/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com

"Paul" <pa********@hotmail.com> wrote in message
news:ca**************************@posting.google.c om...
Hi,

I'm developing a search facility for my web app. In order for the
search criteria to be valid the user must (a) enter some text in a
text box and check and least one checkbox (of which there are two)
and/or (b) select at least one item from a multiple select list box.
I've written the javascript to do the client side validation which
gets called on the click event of my search button. I'd like to
implement server side validation using the validation controls but am
not sure how to achieve this. Can the custom validation control be
used in this instance (i.e. to validate the input from multiple
controls). If so how?

Thanks,

Paul

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by titi | last post: by
3 posts views Thread by Default | last post: by
reply views Thread by ani | last post: by
2 posts views Thread by Osmosis | last post: by
2 posts views Thread by Chris Dunaway | last post: by
reply views Thread by Gary Shell | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.