Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Please help: Validating input from a combination of controls

Reply
Thread Tools

Please help: Validating input from a combination of controls

 
 
Paul
Guest
Posts: n/a
 
      11-26-2003
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
 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      11-29-2003
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:

"Paul" <> wrote in message
news: 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating input - checking for html SL ASP .Net 2 06-16-2005 08:26 PM
Validating user HTML input Peter Morris [Air Software Ltd] ASP .Net 5 01-09-2005 09:13 PM
validating user form input with vs.net/vb.net front end and backend darrel ASP .Net 1 06-24-2004 10:07 PM
validating input (Me.request.form.get(0)) Thierry ASP .Net 1 11-11-2003 10:50 AM
validating input from the form Thierry ASP .Net 1 11-10-2003 02:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57