Hi
I have created a form using a database table to supply the form fields; one of
the fields is a check box, the other a text field. Please see code below,
<form name="add_delivery" method="post"
action="<cfoutput>#CurrentPage#</cfoutput>">
<cfoutput query="get_delivery_types">
<input type="hidden" name="ga_del_type_id#get_delivery_types.currentrow#"
value="#ga_del_type_id#" />
<input name="wp_delivery_active#get_delivery_types.currentrow#" type="checkbox"
class="boxes" id="wp_delivery_active#get_delivery_types.currentrow#"
value="yes" />
<input type="text" name="wp_delivery_cost#get_delivery_types.currentrow#"
id="wp_delivery_cost#get_delivery_types.currentrow#" style="width:50px;"
value="#DecimalFormat(ga_del_guide_cost)#" />
</cfoutput>
<input type="Hidden" name="ResCount"
value="<cfoutput>#get_delivery_types.RecordCount#</cfoutput>">
<input name="submit" type="submit" class="submitBtn" id="submit" value="Update
Delivery Options" style="margin:0px;" />
</form>
I am using the following code to insert the record, however if all the check
boxes are not checked, I get can not find form.wp_delivery_active3 error
message. I know why I am getting this message, because the check box quite
rightly does not exist if not completed. My question is, how do I create a cfif
statement in the below code to specify no if form.wp_delivery_active3 is not
present? Iâve tried a few, but to no avail.
<cfloop
index="LoopCount"
from=1
to=#Val(form.ResCount)#>
<cfset variables.ga_del_type_id="form.ga_del_type_id#Evaluate(LoopCount)#">
<cfset variables.ga_del_type_id="#Evaluate(variables.ga_del_type_id)#">
<cfset
variables.wp_delivery_active="form.wp_delivery_active#Evaluate(LoopCount)#">
<cfset
variables.wp_delivery_active="#Evaluate(variables.wp_delivery_active)#">
<cfset
variables.wp_delivery_cost="form.wp_delivery_cost#Evaluate(LoopCount)#">
<cfset variables.wp_delivery_cost="#Evaluate(variables.wp_delivery_cost)#">
<cfquery datasource="#application.dsn#" name="updateProducts">
INSERT INTO wp_delivery (wp_delivery_active, wp_delivery_detail,
wp_delivery_product_id, wp_delivery_cost)
VALUES (
<cfqueryparam cfsqltype="cf_sql_bit" value="#Variables.wp_delivery_active#">
, <cfqueryparam cfsqltype="cf_sql_integer" value="#variables.ga_del_type_id#">
, <cfqueryparam cfsqltype="cf_sql_integer" value="#wp_products_id#">
, <cfqueryparam cfsqltype="cf_sql_integer"
value="#variables.wp_delivery_cost#">)
</cfquery>
</cfloop>
Thanks
Jason
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318480
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4