|
Getting back to you a bit late, but here’s
how we would implement similar code using cfinclude: EXAMPLE: (SEMI-PSEUDO CODE) (“action” page) <!--- do some validation based on business need –
required fields, valid format, etc.--- > <cfset isValid = validateDemographic(form)> <cfif isValid> Do some more logic (db insert, etc.) <cfinclude template=”dsp_thank_you.cfm”>
// body text for “thank you” page. <cfelse> <cfinclude template=”dsp_form.cfm”>
// dsp_form only has the code between <form>
tags. </cfif> (END) I find this useful when we have the same
form for different uses. For instance, we may have an “add person”
and an “edit person” - same form, one with data one without. The other reason this is useful for us is that
there is a template custom tag that surround the body, so we just switch the
body out based on the validation routine. Another thing we do at times is ONLY display
the invalid form fields for the user, but that is a slightly more complicated
thing. The include has access to the variables of the calling page (in this case “form”
scope variables) without having to set them in the request scope, which is what
prompted my original question. I think I was missing the page flow when I first
looked at the code Anthony From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter H Hi
Anthony, When I
was looking into validation using coldfusion, I found many references to using
cfinlcudes but couldn't find an example of it anywhere. The
approach used here came about simply because I couldn't think of a better
way to cleanly seperate the form itself from the validation. Theres
bound to be advantages and disadvantages to both so If you have an example of
using cfincludes for validation could you post it for me. Any body
else have views on this? Cheers,
Pete (aka lad4bear)
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). CFCDev is supported by New Atlanta, makers of BlueDragon http://www.newatlanta.com/products/bluedragon/index.cfm An archive of the CFCDev list is available at www.mail-archive.com/[email protected] |
