[thelist] Form validation using ASP

Ken Schaefer Ken at adOpenStatic.com
Tue Mar 13 15:03:15 CDT 2007


Apologies to Brian - it wasn't his idea to put things into session variables.
But I still believe that this is not necessary nor desirable.

Cheers
Ken

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Ken Schaefer
Sent: Tuesday, 13 March 2007 12:45 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] Form validation using ASP

Kevin,

I think your basic approach is sub-optimal. I also don't agree with Brian's
suggestion of sticking everything into session variables.

Instead of posting the form to a new page - post the form back to itself.
That way you can easily repopulate the form elements if there's an error. If
there's no error, then you can Response.Redirect to the next page.

I would also write yourself a bunch of helper functions for generating the
form elements.

I know this sounds a little complex - I have a tutorial here (it's a bit
dated, but the fundamentals are sound):
http://www.adopenstatic.com/resources/code/UIValidation.asp

Cheers
Ken

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Kevin Stevens
Sent: Monday, 12 March 2007 11:58 AM
To: thelist at lists.evolt.org
Subject: [thelist] Form validation using ASP

I have a simple booking form with text boxes, check boxes, text areas, 
and dropdown boxes. I am trying to validate this information using ASP, 
sending it to another page to do this, then redirecting back to the 
first one if there is something missing in the required fields. The 
trouble is, the text boxes retain their information, but the check boxes 
are un-ticked, the text areas are blank, and the dropdowns go back to 
their original Select setting. I have been scouring the Internet and 
found some useful code but I can't get any of it to work. Here is an 
example of what I've been trying 
http://www.ratking.co.uk/manhire/test.asp , the code is below...

<snipped> 



More information about the thelist mailing list