Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes

Status
Not open for further replies.

Sherylj

Programmer
Jan 21, 2000
55
US
Help! I need to pass the "nonvalue" checkboxes from a form to an Access database. I know this is simple but I'm having brain freeze. My query is as follows:

<CFQUERY NAME=&quot;AddChange&quot; DATASOURCE=&quot;change&quot; dbtype=&quot;ODBC&quot;>
INSERT INTO tblChanges (Reported_By, Date_Reported, Type, Device_Name, Affected_Midland, Affected_DivLoc, Affected_AS400, Affected_Ethernet, Affected_Sun, Affected_Datastream, Affected_PC, Change_Description, Plan_Test, Backout_Plan, Clients_Notified, Peers_Notified)
VALUES ('#Form.Reported_By#', '#Form.Reported_Date#', '#Form.ChangeType#', '#Form.DeviceName#', '#Form.KEG#', '#Form.Division#', '#Form.AS400#', '#Form.EC#', '#Form.SU#', '#Form.DS#', '#Form.PC#', '#Form.Infinium#', '#Form.win2000#', '#Form.Description#', '#Form.Plan_Test#', '#Form.Backout#', '#Form.Clients_Notified#', '#Form.Peers_Notified#')
</CFQUERY>

All these variables from above are checkboxes.

'#Form.KEG#', '#Form.Division#', '#Form.AS400#', '#Form.EC#', '#Form.SU#', '#Form.DS#', '#Form.PC#', '#Form.Infinium#', '#Form.win2000#',

How do I pass it if it's not defined? The checkbox is off. Thanks.

Sheryl :)
 
you can use some preverification like this:

<cfif Not IsDefined(&quot;Form.checkBboxField&quot;)>
<cfset formCheckBox = &quot;no&quot;>
</cfif>

:)
 
I knew that!! Thanks!! Having a DUH moment.

Sheryl :)
 
Even easier, at the top of the query page...

<cfparam name=&quot;Form.KEG&quot; value=&quot;0&quot;>

For all of them, making 0 whatever value you want, I usually use checkboxes as booleans so if they tick it is a 1, if they don't tick, it isn't defined and the cfparam takes care of that case. Then you can just leave your query alone and it will work, you also don't need to add any extra code to your forms page.

xor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top