Ryan,

I modified the reuseForm tag to work around missing values from form input and from 
queries.  If the form/Query value is not defined, it puts in the default value 
specified in your formfields parameter (or an empty string).  Works great.

Here's the part of the tag that does the action=form part:

<cfcase value="form">
        <CFLOOP LIST="#attributes.fieldlist#" INDEX="counter">
                <CFSET fldName = listgetat(counter,1,";")>
                <CFIF IsDefined("form.#fldName#")>
                        <CFSET "caller.#fldName#" = evaluate("FORM." & fldName)>
                 <CFELSE>
                        <CFIF ListLen(counter,";") gt 1>
                                <CFSET defaultvalue=ListGetAt(counter,2,";")>
                        <CFELSE>
                                <CFSET defaultvalue="">
                        </CFIF>
                        <CFSET "caller.#fldName#" = defaultvalue>
                </CFIF>
        </CFLOOP>       
</cfcase>

Same idea for queries.

HTH,
-Max



At 11/1/2000 04:22 PM -0600, you wrote:
>As I understand it, when you use CF_reuseform, you code your forms
>like <input name=name value="#name#"> and then use cf_reuseform to
>default the variables to blank if loading the form for the first time,
>or set these variables to what was passed in on a form so you
>can redisplay the form (with data filled in) if there were errors.
>
>So how do you code checkboxes using reuseform? I didn't see anything
>about it in the fusebox book nor in the txt file that came with the
>custom tag. My guess would be:
>
><input type=checkbox name=has_bmw value=1 <CFIF has_bmw EQ 1>CHECKED</CFIF>>
>
>or maybe even
>
><input type=checkbox name=has_bmw value=1 <CFIF IsDefined(has_bmw)>CHECKED</CFIF>>
>
>But, if you call cf_reuseform and pass it action="form" formfields="name,has_bmw,etc",
>and the user didn't check has_bmw the first time through, cf_reuseform throws
>an error because FORM.has_bmw does not exist!
>
>What is one to do?
>
>Ryan

------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to