Here's how I have done it in the past.  I created a customtag called
"initalizeFormFields" and pass it a list of formfields that I want to
default to blank

<cfparam name="ATTRIBUTES.formfields" default="">

<cfloop list="#ATTRIBUTES.formfields#" index="thisField">
  <cfset thisVar = "CALLER.FORM.#thisField#">
  <cfparam name="#thisVar#" default="">
</cfloop>


I call it at the top of the page:


<cf_initalizeFormFields formfields="foo">


This will return a set of form variables all with a default value of ""

Then in your input fields


<input type="test" name="foo" value="#form.foo#"> 



The nice thing about this is when you submit the form back onto itself you
can test validate, create error messages and still have the fields fille din
for the user. 





-----Original Message-----
From: Torrent Girl [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 24, 2005 1:29 PM
To: CF-Newbie
Subject: Re: Help with form fields

But not all form fields can be validated by CFFORM right?

Isn't it better to use JavaScript?



>Hi Tgirl.
>
>Just wondering why you would go through that cfif statemet. If a field 
>is not required I would simply
>use:
> 
><cfinput name="SomeName" type="text"
>value="#Some.Value#" required="no" message="Please enter some value">
>
>This way you would avoid the error message if the user does not enter 
>in info.
>
>If you'd like to make the info required, simply place a "yes" in the 
>required field.
>
>Let me know if I'm understanding your question correctly.
>
>-Ev72178
>
>--- Torrent Girl <[EMAIL PROTECTED]> wrote:



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1213
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to