I think it's tacky in that you've probably got one error per field. That
means that if they leave two fields blank, your code only catches the first
one. They fill that in, then submit again and the next error catches.

Wouldn't it be nice to display all of the errors at once?

<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED]
Sent: Monday, November 06, 2006 8:44 AM
To: CF-Talk
Subject: Validating a form


Hey, I sometimes use this bit of code to handle validation.

<cfif Len(FORM.cardexpmonth) EQ 0 OR Len(FORM.cardexpyear) EQ 0>
        <script>
          alert ("Please select a credit card expiration month/year");
          history.back();
         </script>
  <p>You must select a valid expiration date before submitting form</p>
  <p><cfoutput><a href="#CGI.http_referer#">&lt;Go back</a></cfoutput></p>
  <cfabort>
</cfif>

FORM.cardexpmonth and year are dropdown menus. If they didnt make a
selection, this script kicks in. If JS is turned off, the Text with link
kicks in.

ANybody got a better way to handle this? OR is this good enough. Or is this
way incredibly tacky?

Will



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259287
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to