Rick
-----Original Message-----
From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 6:04 PM
To: CF-Talk
Subject: RE: How to validate form variables with this method including
Encoding: multi-part/form-data
Rick,
I think you might want to rethink how you handle form data. You'll make
your life a lot simpler from the sound of it.
You shouldn't have to copy your form vars to session scope and whatnot if
you just process your form data immediately. And you can do validation no
problem server-side with this (very basic) model, below. You won't need to
mess around with _javascript_, cfinput etc. unless you want to.
HtH,
--Matt--
<cfif isdefined ("url.Action")>
<cfswitch _expression_="#url.Action#">
<!---
case 1
--->
<cfcase value="1">
<cfif not CompareNoCase(cgi.request_method,"post")>
<!--- do form validation here --->
<!--- do data processing here --->
<!--- now show the thank you page. --->
<cfinclude template="yourheaderfile.cfm">
<p>Golly, Thanks!</p>
<cfinclude template="yourfooterfile.cfm">
<cfabort>
</cfif>
</cfcase>
<!---
case 2
--->
<cfcase value="2">
<!---
put other actions run from this template in other case statements. Or
don't. I often leave a case statement in regardless of whether I have
multiple choices or not. Makes the code expandable and builds in a touch of
url hacking protection with the cfdefaultcase.
--->
</cfcase>
<cfdefaultcase>
<!---
a url parameter value came in that was not one we
expected. alert security here.
--->
</cfdefaultcase>
</cfswitch>
</cfif>
<cfinclude template="yourheaderfile.cfm">
<cfoutput>
<form
action=""> method="post"
enctype="multipart/form-data">
</cfoutput>
Source File Name:<BR>
<input
name="FileContents"
type="FILE"
size="45"><br>
<input
type="Text"
name="myDogsName">Your Dog's Name:<br>
<input
type="submit"
value="Upload File">
</form>
<cfinclude template="yourfooterfile.cfm">
--
-------------------------------------------
Matt Robertson, [EMAIL PROTECTED]
MSB Designs, Inc. http://mysecretbase.com
-------------------------------------------
--
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

