If a checkbox is not checked, it doesn't exist in the form scope when
submitted, so you'll need to handle that, e.g.
<cfif isDefined('form.myCheckbox')>
use the checkbox
<cfelse>
Something else
</cfif>
Note that this is different behavior from most other fields, where even
if it has no value, the field still exists in the form scope with a
blank value. With checkboxes, if there is no check, there is no field.
> -----Original Message-----
> From: Web Master [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 19, 2006 3:56 PM
> To: CF-Talk
> Subject: How to check the status of a checkbox in a array
>
> I am creating an array of records in a single query.
>
> I want the user to be able to select the records the wish to update,
input
> the new values for each record they with to update, then update.
>
> I have my form which diplayes the infomation with the folloing
checkbox.
> There may be one record for one customers and five records for
another.
>
> If I check all of the checkboxes it works fine, If I don't I get this
> error.
>
> This information is going into a holding database to be verified befor
the
> update takes place. That is the reason I am useing insert statments
> instead of update statments.
>
> Element fld_bussPurpChange_2 is undefined in a Java object of type
class
> coldfusion.filter.FormScope referenced as
>
> Here is my code
>
> Form.
>
> <cfinput type="checkbox"
> name="fld_bussPurpChange_#oracle_cust_bussPurp.currentrow#"
value="Yes" />
>
>
> Action.
>
> <cfloop from="1" to="#form.bussPurpRecords#" index="ii">
>
> <cfset variables.fld_bussPurpChange =
form["fld_bussPurpChange_"&ii]/>
> <cfset variables.SITE_USE_ID = form["fld_SITE_USE_ID_"&ii]/>
> <cfset variables.SITE_USE_CODE = form["fld_SITE_USE_CODE_"&ii]/>
> <cfset variables.LOCATION = form["fld_LOCATION_"&ii]/>
> <cfset variables.TAX_REFERENCE = form["fld_TAX_REFERENCE_"&ii]/>
> <cfset variables.TAX_CODE = form["fld_TAX_CODE_"&ii]/>
> <cfset variables.PRIMARY_SALESREP_ID =
> form["fld_PRIMARY_SALESREP_"&ii]/>
> <cfset variables.SHIP_PARTIAL = form["fld_SHIP_PARTIAL_"&ii]/>
> <cfset variables.FREIGHT_TERM = form["fld_FREIGHT_TERM_"&ii]/>
> <cfset variables.PRICE_LIST_ID = form["fld_PRICE_LIST_ID_"&ii]/>
> <cfset variables.WAREHOUSE_ID = form["fld_WAREHOUSE_ID_"&ii]/>
>
> <cfif variables.fld_bussPurpChange EQ "Yes">
> <!--- Update this product with the new id --->
> <cfquery name="insertSiteUseinfo" datasource="cust_profile">
> INSERT INTO AR_RA_SITE_USES_ALL
> (SITE_USE_ID,
> FORM_REQUEST_ID,
> NEW_OLD,
> SITE_USE_CODE,
> ADDRESS_ID,
> LOCATION,
> TAX_REFERENCE,
> TAX_CODE,
> PRIMARY_SALESREP_ID,
> SHIP_PARTIAL,
> FREIGHT_TERM,
> PRICE_LIST_ID,
> WAREHOUSE_ID)
> VALUES
> ('#(variables.SITE_USE_ID)#',
> '#(getRequestNo.New_req_num)+1#',
> 'New',
> '#(variables.SITE_USE_CODE)#',
> '#form.fld_ADDRESS_ID#',
> '#(variables.LOCATION)#',
> '#(variables.TAX_REFERENCE)#',
> '#(variables.TAX_CODE)#',
> '#(variables.PRIMARY_SALESREP_ID)#',
> '#(variables.SHIP_PARTIAL)#',
> '#(variables.FREIGHT_TERM)#',
> '#(variables.PRICE_LIST_ID)#',
> '#(variables.WAREHOUSE_ID)#')
> </cfquery>
> </cfif>
> </cfloop>
>
> Thank you,
> Keith
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253542
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4