Mark,

The only way I know to do this is to use a CFPARAM for each expected
variable, with a defult of null.  You could do this dynamically using an
index loop with a variable set in your application.cfm file that tells it
how many to look for. Then, when you change your form, you only need adjust
the value in your application.cfm file to fix your app.  Then, on the server
side, loop through the passed form fields, and reset the value of the var if
a value is found.  Then, append name of the null value forms to your "val"
variable in your CFLOCATION.

Dave


----- Original Message -----
From: "Mark Leder" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, July 01, 2002 12:57 AM
Subject: Aggregating server side form validation messages


I'm doing both client side (JS) and server-side form validation.
Typically in JS Client side, if there are a number of required fields
not filled in by the user, upon submit, a single popup alert occurs
listing all the fields that need to be filled in.

I want to do this same process with server side (using CFM) as well.  In
other words, using a first name field as an example, I'd like to replace
the CFLOCATION statements in each check group (I could wind up with 30
checks on the various field) with something that will "remember" the
#val# number and then lump them all one CFLOCATION statement at the end
of the validation routine, such as:

<CFLOCATION
URL="#REQUEST.webroot##REQUEST.Ssubwebroot#/default.cfm?pID=#URL.pID#&va
l=19a, 19b, etc." ADDTOKEN="No">

The &val= appendage would be dynamic, only having those values which did
not pass the server-side validation.

How would I accomplish something like this?

==============================================

<!--- First Name --->
<!--- Check that the field is required, 19a --->
<CFLOCK SCOPE="SESSION" TIMEOUT="10" TYPE="READONLY">
<CFIF SESSION.ecom.firstname IS "">
<CFLOCATION
URL="#REQUEST.webroot##REQUEST.Ssubwebroot#/default.cfm?pID=#URL.pID#&va
l=19a" ADDTOKEN="No">
</CFIF>
</CFLOCK>

<!--- Check that the field has only alphabetical
characters, 19b --->
<CFLOCK SCOPE="SESSION" TIMEOUT="10" TYPE="READONLY">
<CFSET VARIABLES.testFirstName =
#IsAlphabet(SESSION.ecom.firstname)#>
</CFLOCK>
<CFIF VARIABLES.testFirstName IS "No">
<CFLOCATION
URL="#REQUEST.webroot##REQUEST.Ssubwebroot#/default.cfm?pID=#URL.pID#&va
l=19b" ADDTOKEN="No">
</CFIF>


===============================================

Thanks,
Mark


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to