The scenario:
I've got a self-posting form that validates against validateForm.cfm. If there 
are errors in the form, I declare an error message variable and put in some 
text:

<cfset errorMessage = "There were errors in your submission.">

The purpose:
If there are errors, I want the form to be populated with the form scope, 
instead of the query scope, so that the user doesn't have to retype everything. 
If there are no errors, use the query results:

<cfif isDefined("errorMessage")>
        <input type="Text" name="userFirstName" value="#form.userFirstName#">
        <cfelse>
                <input type="Text" name="userFirstName" 
value="#queryUser.userFirstName#">
</cfif>

The problem:
I've got a set of dynamic checkboxes from the query "getCheckboxes" with the 
input name of "checkboxList". Just like in the code above, I want to check the 
checkboxes with the form scope if there are errors. But, of all the ways I've 
tried, I can't get the checkboxes to check:

<cfloop query="getCheckboxes">
   <cfset local.currentCheckboxID = getCheckboxes.checkboxID />
      <cfif isDefined("errorMessage")>
         <input name="checkboxList" type="checkbox" 
value="#getCheckboxes.checkboxID#"
            <cfloop ???>
               <cfif ??? EQ local.currentCheckboxID> 
                  checked
               </cfif>
            </cfloop>
         >
         <cfelse>
            <input name="checkboxList" type="checkbox" 
value="#getCheckbox.checkboxID#"
               <cfloop query="queryUser">
                  <cfif queryUser.checkboxID EQ local.currentCheckboxID> 
                     checked
                  </cfif>
               </cfloop>
            >
   </cfif>
</cfoop>

What should I loop over and what should my comparison value be? I'm out of 
ideas.

Thanks for the help.

Cameron

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231620
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to