Your description of the function of ex2_process.cfm sound exactly
like what I do now with server-side validation.  (At this point there is
no client-side validation involved...)

I have the user complete the form, which submits back to the page
it's a part of, then I run code against all the field inputs that I want
to validate.  I create a Form_Errors struct, and add error messages
to that as each input is validated.

Once all is validated, if there are no error messages in the Form_Errors
struct, then the data is processed and put into the db or whatever
is happening with it.

If there are errors, the errors are displayed above the appropriate
input and the users is informed as to what the problem is and perhaps
a solution, as in a date format error.

The solution has worked extremely well for several years now.

I guess what we're talking about here is a two-tiered validation scheme:

First client-side JS validates and displays appropriate errors (I prefer
on blur validation since it gives immediate feedback about input errors),
then once all JS validation is passed (which could include Ajax validation
to validate input against data in a db, such as whether a username is
already in use or not) the form is submitted by the user using the
Submit button and the data is run through my normal server-side
CF validation as described above.

If there are errors, then the error messages are displayed and the process
starts all over again, including running everything through the client-side
validation first, then the server-side validation second.

If all passes, then the appropriate data-handling (queries, etc.) occur.

Does this describe the process you're trying to get me to understand?

Rick



-----Original Message-----
From: Dan G. Switzer, II [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 18, 2007 6:16 AM
To: CF-Talk
Subject: RE: Client-side validation or Server-side Validation?

Rick,

>I see that page and the code's role in displaying the message.
>
>But the part that I'm trying to figure is how ex2_process.cfm
>is working to provide the validation and return that message
>to ex2.3_mailing_list_validation.cfm.
>
>ex2_process.cfm is the page doing your server-side validation,
>right?
>
>ex2.3_mailing_list_validation.cfm is just your client-side validation,
>form, and error/success message display page, correct?

Well this form is extremely simple--it was done for a presentation. So I'm
going to explain the functionality as if it was a larger form.

Basically the ex2_process.cfm validates all the data on via server-side
validation rules. If there are any errors, I build a complex variable (a
struct or an array) to hold the errors in. 

If there are errors in the form, instead of processing the form--the main
form page is displayed again--which handles displaying of the error
messages--and ex2_process.cfm stops processing code.

As an added wrinkle, trying signing up for mailing list w/the e-mail address
I'm posting from. This is mean to emulate something you can only validate on
the server. You'll also notice that no JS error is thrown, that the error is
generated by the server--because the page is reloaded.

Once you full grasp whats going on, I'll show you code that allows you to
improve on that.

-Dan




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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

Reply via email to