Hi Pete,

Instead of this:
FORM["ind_inpatient_"][i]

I think you might want this:
FORM["ind_inpatient_" & i]

-- Josh


----- Original Message ----- 
From: "Pete Ruckelshaus" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Tuesday, February 20, 2007 11:40 AM
Subject: Need help - looping through dynamic variables


>I have a form with a set of checkboxes.  There could be any number of
> rows of checkboxes, since the fields are populated from the database
> (values come from a lookup table).  I am passing the number of rows to
> expect when the form is processed via the "discount_category_count"
> form field.  The set of field names are "ind_inpatient_1",
> "ind_inpatient_2", etc.
>
> The code:
>
> <cfloop index="i" from="1" to="#FORM.discount_category_count#" step="1">
> <cfscript>
> tmp = structnew();
> tmp.ind_inpatient = 0;
> tmp.ind_outpatient = 0;
> if (isDefined(FORM["ind_inpatient_"][i]) AND FORM["ind_inpatient_"][i] EQ 
> 1) {
> tmp.ind_inpatient = 1;
> }
> if (isDefined(FORM["ind_outpatient_"][i]) AND
> FORM["ind_outpatient_"][i] EQ 1) {
> tmp.ind_outpatient = 1;
> }
> tmp.discount_amt = FORM["discount_value_"][i];
> tmp.ind_invoice = FORM["ind_invoice_"][i];
> </cfscript>
> </cfloop>
>
> The problem is, this is throwing the following error:
>
> Element ind_inpatient_ is undefined in a Java object of type class
> coldfusion.filter.FormScope referenced as
>
> and the line number for the error is the first IF statement in the
> cfscript block.
>
> What am I doing wrong?
>
> Thanks.
>
> Pete
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:270216
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to