Oh, fabulous, Justin! Thank you so much... that will save untold amounts of 
time down the line.

>> Obviously you could do a <cfif FORM.fieldname EQ
>> "red">selected="selected"</cfif> inside the tag of every single one but
>> it seems like that would get unwieldy in longer forms. Is there an
>> easier way?
>
>The easiest way with more modern versions of ColdFusion is to use the CFFORM
>tag (in place of the standard HTML form tag) and specify the
>preservedata="yes" attribute.  Likewise, use the ColdFusion input tags such
>as CFINPUT in place of the HTML input tag, etc.  ColdFusion will keep track
>of the form variables and pre-fill the form values for you when the page is
>re-generated.
>
>If you want to do it yourself, the method you described is the way to go,
>and it is tedious.  For checkboxes specifically, they are only submitted if
>they are checked, so if you have ONE checkbox with a given name, you can use
>the isDefined() function to see if it exists (i.e. <cfif
>isDefined('form.somefield')>checked="checked"</cfif>).  If you have multiple
>checkboxes with the same name, the field will exist if any one of them is
>checked, so you'll need to check for existence AND the specific value (or
>CFPARAM it to be blank and just check for the values).
>
>I hope that all makes sense.  Cheers!
>
>
>-Justin 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4946
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to