Well, the isDefined statement would be a good thing to use here.

<cfif isDefined("form.chkRemove#X#")>
    <cfset remove=true>
<cfelse>
    <cfset remove=false>
</cfif>

and then test for remove for processing (assuming you are processing it
inside the loop).  By the way, I typically use conditional looping
instead of indexed looping for things like this.  This way you don't
have to know how many records to start/end with.  Here's how it goes...

<cfset x=1> <--- To start the index off --->
<cfloop condition="isDefined('form.pvAnswer_ID#x#')><!--- test on  a
field that I know must exist regardless of value.  In other words, NOT a
checkbox --->

.. insert your other processing here....

<cfset x=x+1><!--- increment the counter (don't forget this) --->
</cfloop>


David Schmidt
Macromedia Advanced ColdFusion Developer
Portent Interactive, Inc.


----- Original Message -----
From: "David Jones" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, June 29, 2002 6:27 AM
Subject: Dynamic Checkboxes


: I am having some trouble with dynamically named checkboxes. This is
what I
: am trying to do
:
:
: On a form I have some dynamically named form variables. like....
:
: <Cfloop from = 1 to = #vLoopNUm# index="x">
: <input type="text" name="pvAnswer_ID#x#" value="">
: <input type="text" name="txtAnswer_Display_sequence#x#" value="">
: <input type="text" name="txtObject_Type_ID#x#" value="">
: <input type="text" name="txtAnswer_Text#x#" value="">
: <input type="text" name="txtAnswer_Field_Name#x#" value="">
: <input type="text" name="txtAnswer_Code#x#" value="">
: <input type="checkbox" name="chkRemove#x#" value="">
: </Cfloop>
:
: I submit to....
:
: <Cfloop from = 1 to = #vLoopNUm# index="x">
: <cfset vAnswer_ID = "pvAnswer_ID#x#">
: <cfset vAnswer_Display_sequence = "txtAnswer_Display_sequence#x#">
: <cfset vObject_Type_ID = "txtObject_Type_ID#x#">
: <cfset vAnswer_Text = "txtAnswer_Text#x#">
: <cfset vAnswer_Field_Name = "txtAnswer_Field_Name#x#">
: <cfset vAnswer_Code = "txtAnswer_Code#x#">
: <cfset vRemove = "chkRemove#x#">
:
: #evaluate(vAnswer_ID)#
: #evaluate(vAnswer_Display_sequence)#
: #evaluate(vObject_Type_ID)#
: #evaluate(vAnswer_Text)#
: #evaluate(vAnswer_Field_Name)#
: #evaluate(vAnswer_Code)#
: #evaluate(vRemove)#
:
: <CFloop>
:
:
:
: All of these work except for the checkbox. The reason is because
checkboxes
: aren't submitted of they aren't checked. So I would think that I
should use
: some thing like this to verify that the variable exists before setting
the
: variable to it's value.
:
: <cfif #parameterExists(evaluate(vRemove))#>
: <cfset vremove = "1">
: <cfelse
: cfset vremove="0">
: <cfif>
:
: but this doesn't work either.
:
:
:
: Any Suggestions.
:
: Thanks,
:
: Dave
:
:
:
: 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to