i usually do something like this....

<CFSET entryErrors = "">

<CFIF thing that is incorrect>
    <CFSET entryErrors = ListAppend(entryErrors, "Please fix the thing that
is incorrect.", ";")>
</CFIF>

in my server side action, then in the form display

<CFIF Len(entryErrors)>
<CFOUTPUT>
     Please correct the following :
    <UL>
        <CFLOOP LIST="#entryErrors#" DELIMITERS=";" INDEX="error">
            <LI> #error# </LI>
        </CFLOOP>
    </UL>
</CFOUTPUT>
</CFIF>


----- Original Message -----
From: "Mark Leder" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, July 01, 2002 4:57 PM
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
>
> 
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to