Checkbox fields only exist upon submission if they are checked. I always create cfparams for checkbox fields on the action page.
> -----Original Message----- > From: Douglas Brown [mailto:[EMAIL PROTECTED]] > Sent: Friday, June 28, 2002 3:46 PM > To: CF-Talk > Subject: trouble passing variables > > > I have a form that is populated from a query, that has several > checkboxes. The form posts back to itslef for update, but when I make > modifications to the checkboxes, I get a expression evaluation error > that it cannot find the checkbox form fields. I have enabled debugging > and in fact the variables are not getting passed. I have pasted the form > below, for some insight. > > > <cfparam name="AC" default="0"> > <cfparam name="cruise_control" default="0"> > <cfparam name="power_brakes" default="0"> > <cfparam name="tilt_wheel" default="0"> > <cfparam name="power_locks" default="0"> > <cfparam name="leather" default="0"> > <cfparam name="power_steering" default="0"> > <cfparam name="am_fm" default="0"> > <cfparam name="power_windows" default="0"> > <cfparam name="power_seats" default="0"> > <cfparam name="cass" default="0"> > <cfparam name="d_airbag" default="0"> > <cfparam name="CD" default="0"> > <cfparam name="p_airbag" default="0"> > <cfparam name="anti_lock" default="0"> > <cfparam name="convertible" default="0"> > <cfparam name="four_wheel_drive" default="0"> > <cfparam name="hatchback" default="0"> > <cfparam name="tow_pkg" default="0"> > <cfparam name="sunroof" default="0"> > <cfparam name="classic" default="0"> > <cfparam name="show_price" default="0"> > <cfparam name="mfgDate" default=""> > <cfparam name="make" default=""> > <cfparam name="model" default=""> > <cfparam name="vin" default=""> > <cfparam name="stock_number" default=""> > <cfparam name="color" default=""> > <cfparam name="condition" default=""> > <cfparam name="sale_price" default=""> > <cfparam name="show_price" default="0"> > <cfparam name="photo1" default=""> > <cfparam name="photo2" default=""> > <cfparam name="photo3" default=""> > <cfparam name="photo4" default=""> > > > <cfif isDefined("action")> > > <!---Update the inventory table//---> > > <cfquery datasource="#request.site.dsn#" name="update_inventory"> > update inventory > set mfg_date = '#mfg_date#', > stock_number = '#attributes.stock_number#', > vin = '#attributes.vin#', > make = '#attributes.make#', > model = '#attributes.model#', > mileage = '#attributes.mileage#', > color = '#attributes.color#', > condition = '#attributes.condition#', > sale_price = #attributes.sale_price#, > show_price = '#attributes.show_price#' > where id = #attributes.inventory_id# > </cfquery> > > <!---Update the options table//---> > > <cfquery datasource="#request.site.dsn#" name="update_options"> > update options > set ac = #attributes.ac#, > convertible = #attributes.convertible#, > d_airbag = #attributes.d_airbag#, > p_airbag = #attributes.p_airbag#, > hatchback = #attributes.hatchback#, > anti_lock = #attributes.anti_lock#, > am_fm = #attributes.am_fm#, > cass = #attributes.cass#, > power_seats = #attributes.power_seats#, > power_windows = #attributes.power_windows#, > power_locks = #attributes.power_locks#, > power_brakes = #attributes.power_brakes#, > power_steering = #attributes.power_steering# > tilt_wheel = #attributes.tilt_wheel#, > cruise_control = #attributes.cruise_control#, > cd = #attributes.cd#, > four_wheel_drive = #attributes.four_wheel_drive#, > sunroof = #attributes.sunroof#, > leather = #attributes.leather#, > tow_pkg = #attributes.tow_pkg#, > classic = #attributes.classic# > where inventory_id = #attributes.inventory_id# > </cfquery> > </cfif> > > <!---Populate the form//---> > > <cfquery datasource="#request.site.dsn#" > name="get_inventory_for_update"> > select inventory.id, > inventory.mfg_date, > inventory.stock_number, > inventory.vin, > inventory.make, > inventory.model, > inventory.mileage, > inventory.color, > inventory.condition, > inventory.sale_price, > inventory.show_price, > options.ac, > options.convertible, > options.d_airbag, > options.p_airbag, > options.hatchback, > options.anti_lock, > options.am_fm, > options.cass, > options.power_seats, > options.power_windows, > options.power_locks, > options.power_brakes, > options.power_steering, > options.tilt_wheel, > options.cruise_control, > options.cd, > options.four_wheel_drive, > options.sunroof, > options.leather, > options.tow_pkg, > options.classic, > photos.photo, > photos.thumbnail > from inventory > inner join options on inventory.id = options.inventory_id > inner join photos on inventory.id = photos.inventory_id > where inventory.id = #attributes.inventory_id# > </cfquery> > <p> </p> > > <form > action="index.cfm?fuseaction=updateInventory&inventory_id=<cfoutput>#att > ributes.inventory_id#&popup=true&action=update</cfoutput>" > method="post"> > <table width="60%" cellspacing="0" cellpadding="1" border="0" > align="center"> > <tr bgcolor="#336666"> > <td> > <table width="100%" cellspacing="0" cellpadding="0" border="0" > align="center"> > <tr> > <td bgcolor="#FB8B27" align="center" class="consoleBlack" > height="24"><b>Update Inventory</b></td> > </tr> > <tr> > <td width="50%" valign="top" bgcolor="#FFFFFF"> > <table width="100%" border="0" cellpadding="0"> > <tr> > <td bgcolor="#FFFFFF" valign="top"><table width="100%" > border="0" cellpadding="5" cellspacing="0"> > <tr> > <td bgcolor="#FFFFFF" colspan="2"><img > src="images/details.gif"></td> > </tr> > <tr> > <td bgcolor="#FFFFFF" colspan="2"> </td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">MFG > Date</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="mfg_date" size="20" maxlength="4" > value="<cfoutput>#dateFormat(get_inventory_for_update.mfg_date, > "yyyy")#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Make</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="make" > value="<cfoutput>#get_inventory_for_update.make#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Model</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="model" > value="<cfoutput>#get_inventory_for_update.model#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Mileage</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="mileage" > value="<cfoutput>#get_inventory_for_update.mileage#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Vin</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="vin" > value="<cfoutput>#get_inventory_for_update.vin#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Stock > #</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="stock_number" > value="<cfoutput>#get_inventory_for_update.stock_number#</cfoutput>"></t > d> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Color</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="color" > value="<cfoutput>#get_inventory_for_update.color#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Condition</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="condition" > value="<cfoutput>#get_inventory_for_update.condition#</cfoutput>"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Price</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="text" name="sale_price" > value="<cfoutput>#round(get_inventory_for_update.sale_price)#</cfoutput> > "> > <br> > <cfoutput><input type="checkbox" name="show_price" > value="#get_inventory_for_update.show_price#" <cfif > (get_inventory_for_update.show_price) EQ > 1>checked</cfif>></cfoutput> Display [Ask Dealer] to public > </td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">image_1</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="file" name="photo1"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">image_2</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="file" name="photo2"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">image_3</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="file" name="photo3"></td> > </tr> > <tr> > <td width="15%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">image_4</td> > <td bgcolor="#FFFFFF" class="consoleBlack" width="85%"> > <input type="file" name="photo4"></td> > </tr> > </table></td> > <td valign="top" bgcolor="#FFFFFF"><table width="100%" > border="0" cellpadding="5" cellspacing="0"> > <tr> > <td bgcolor="#FFFFFF" colspan="4"><img > src="images/options.gif"></td> > </tr> > <tr> > <td bgcolor="#FFFFFF" colspan="4"> </td> > </tr> > <tr> > <td width="39%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">A/C</td> > <td width="13%" bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="ac" > value="#get_inventory_for_update.ac#" <cfif > (get_inventory_for_update.ac) EQ 1>checked</cfif>></cfoutput> > </td> > <td width="33%" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Cruise</td> > <td width="15%" bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="cruise_control" > value="#get_inventory_for_update.cruise_control#" <cfif > (get_inventory_for_update.cruise_control) EQ > 1>checked</cfif>></cfoutput> > </td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Power > Brakes</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="power_brakes" > value="#get_inventory_for_update.power_brakes#" <cfif > (get_inventory_for_update.power_brakes) EQ 1>checked</cfif>></cfoutput> > </td> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Tilt > Wheel</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="tilt_wheel" > value="#get_inventory_for_update.tilt_wheel#" <cfif > (get_inventory_for_update.tilt_wheel) EQ > 1>checked</cfif>></cfoutput></td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Power > Locks</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="power_locks" > value="#get_inventory_for_update.power_locks#" <cfif > (get_inventory_for_update.power_locks) EQ 1>checked</cfif>></cfoutput> > </td> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">Leather</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="leather" > value="#get_inventory_for_update.leather#" <cfif > (get_inventory_for_update.leather) EQ 1>checked</cfif>></cfoutput></td> > </tr> > <tr> > <td height="34" nowrap bgcolor="#FFFFFF" > class="consoleBlack">Power > Steering</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="power_steering" > value="#get_inventory_for_update.power_steering#" <cfif > (get_inventory_for_update.power_steering) EQ > 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">AM/FM</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="am_fm" > value="#get_inventory_for_update.am_fm#" <cfif > (get_inventory_for_update.am_fm) EQ 1>checked</cfif>></cfoutput></td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Power > Windows</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="power_windows" > value="#get_inventory_for_update.power_windows#" <cfif > (get_inventory_for_update.power_windows) EQ > 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Cass > Player</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="cass" > value="#get_inventory_for_update.cass#" <cfif > (get_inventory_for_update.cass) EQ 1>checked</cfif>></cfoutput></td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">D > Airbag</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="d_airbag" > value="#get_inventory_for_update.d_airbag#" <cfif > (get_inventory_for_update.d_airbag) EQ 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">CD > player</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="cd" > value="#get_inventory_for_update.cd#" <cfif > (get_inventory_for_update.cd) EQ 1>checked</cfif>></cfoutput> > </td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">P > Airbag</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="p_airbag" > value="#get_inventory_for_update.p_airbag#" <cfif > (get_inventory_for_update.p_airbag) EQ 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">Anti-lock</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="anti_lock" > value="#get_inventory_for_update.anti_lock#" <cfif > (get_inventory_for_update.anti_lock) EQ 1>checked</cfif>></cfoutput> > </td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">Convertible</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="convertible" > value="#get_inventory_for_update.convertible#" <cfif > (get_inventory_for_update.convertible) EQ > 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">4WD</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="four_wheel_drive" > value="#get_inventory_for_update.four_wheel_drive#" <cfif > (get_inventory_for_update.four_wheel_drive) EQ > 1>checked</cfif>></cfoutput> > </td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">Hatchback</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="hatchback" > value="#get_inventory_for_update.hatchback#" <cfif > (get_inventory_for_update.hatchback) EQ > 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Tow > Pkg</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="tow_pkg" > value="#get_inventory_for_update.tow_pkg#" <cfif > (get_inventory_for_update.tow_pkg) EQ 1>checked</cfif>></cfoutput> > </td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Sun > Roof</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="sunroof" > value="#get_inventory_for_update.sunroof#" <cfif > (get_inventory_for_update.sunroof) EQ 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack">Classic Car</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="classic" > value="#get_inventory_for_update.classic#" <cfif > (get_inventory_for_update.classic) EQ 1>checked</cfif>></cfoutput> > </td> > </tr> > <tr> > <td nowrap bgcolor="#FFFFFF" class="consoleBlack">Power > Seats</td> > <td bgcolor="#FFFFFF" class="consoleBlack"> > <cfoutput><input type="checkbox" name="power_seats" > value="#get_inventory_for_update.power_seats#" <cfif > (get_inventory_for_update.power_seats) EQ > 1>checked</cfif>></cfoutput></td> > <td nowrap bgcolor="#FFFFFF" > class="consoleBlack"> </td> > <td bgcolor="#FFFFFF" class="consoleBlack"> </td> > </tr> > <tr> > <td bgcolor="#FFFFFF" colspan="4" height="100%" > align="right"> </td> > </tr> > <tr> > <td bgcolor="#FFFFFF" colspan="4" height="100%" > align="right"> </td> > </tr> > <tr> > <td bgcolor="#FFFFFF" colspan="4" height="100%" > align="right"> </td> > </tr> > <tr> > <td bgcolor="#FFFFFF" colspan="4" height="100%" > align="right"> > <cfoutput><input type="hidden" name"inventory_id" > value="#get_inventory_for_update.id#"></cfoutput> > <input type="submit" value="Update inventory"> > </td> > </tr> > </table></td> > </tr> > </table></td> > </tr> > </table> > </td> > </tr> > </table> > </form> > > > > > Douglas Brown > Email: [EMAIL PROTECTED] > > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists