RE: Check Boxes - another NUG question
Worked! Thanks for the advice. What is a bit daunting about CF for newbies is the various valid approaches to accomplish the same task. Rick -Original Message- From: Kreig Zimmerman [mailto:kkz;foureyes.com] Sent: Friday, 01 November, 2002 10:54 To: CF-Talk Subject: Re: Check Boxes - another NUG question Oh yeah, I may have slightly misunderstood the last question, so to add: The way to do this on the form page is this: input type=checkbox name=thisBox value=1#iif(Query.thisBox, DE(' checked'),DE(''))# .since it is a boolean we are using as a value, in the IIF, 1 evaluates to true, and 0 to false. Thus only 1s make the checkbox be checked. Randell B Adkins wrote: In the database field you can set the value to anything you want, however you will need to test for the value to properly set the checkboxes on the form to be checked or unchecked. Example: CheckBoxField: Value could be AGREE or DISAGREE on the Form: input type=checkbox name=abc value=Agree CFIF qMyQuery.CheckBoxField EQ 'AGREE'checked/cfif [EMAIL PROTECTED] 11/01/02 10:29AM When querying a db where some original input fields were check boxes and were inserted into the db as a binary (yes/no, 1/0, on/off), is the only way to display a check box on the query page, either checked or unchecked, to create a form and add an insert field? If so, I'm having trouble with the conditional logic. Is there an approach I'm overlooking. Rick ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
Re: Check Boxes - another NUG question
In the database field you can set the value to anything you want, however you will need to test for the value to properly set the checkboxes on the form to be checked or unchecked. Example: CheckBoxField: Value could be AGREE or DISAGREE on the Form: input type=checkbox name=abc value=Agree CFIF qMyQuery.CheckBoxField EQ 'AGREE'checked/cfif [EMAIL PROTECTED] 11/01/02 10:29AM When querying a db where some original input fields were check boxes and were inserted into the db as a binary (yes/no, 1/0, on/off), is the only way to display a check box on the query page, either checked or unchecked, to create a form and add an insert field? If so, I'm having trouble with the conditional logic. Is there an approach I'm overlooking. Rick ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
Re: Check Boxes - another NUG question
The way I've always done this is this: On the form page: input type=checkbox name=thisBox value=1 On the processing page: cfparam name=form.thisBox default=0 ..the benefit of this approach is that, should the checkbox be checked on the form page, form.ThisBox is passed to the processing page with a value of 1. When it is _not_ checked, it is not passed to the processing page at all; and the param tells CF that the default value for form.thisBox is 0. Takes care of any problems. The easiest way to do it, especially since I to tend to store checkbox values as BITs in the DB. Kennerly, Rick H CIV wrote: When querying a db where some original input fields were check boxes and were inserted into the db as a binary (yes/no, 1/0, on/off), is the only way to display a check box on the query page, either checked or unchecked, to create a form and add an insert field? If so, I'm having trouble with the conditional logic. Is there an approach I'm overlooking. Rick ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
Re: Check Boxes - another NUG question
Oh yeah, I may have slightly misunderstood the last question, so to add: The way to do this on the form page is this: input type=checkbox name=thisBox value=1#iif(Query.thisBox, DE(' checked'),DE(''))# ..since it is a boolean we are using as a value, in the IIF, 1 evaluates to true, and 0 to false. Thus only 1s make the checkbox be checked. Randell B Adkins wrote: In the database field you can set the value to anything you want, however you will need to test for the value to properly set the checkboxes on the form to be checked or unchecked. Example: CheckBoxField: Value could be AGREE or DISAGREE on the Form: input type=checkbox name=abc value=Agree CFIF qMyQuery.CheckBoxField EQ 'AGREE'checked/cfif [EMAIL PROTECTED] 11/01/02 10:29AM When querying a db where some original input fields were check boxes and were inserted into the db as a binary (yes/no, 1/0, on/off), is the only way to display a check box on the query page, either checked or unchecked, to create a form and add an insert field? If so, I'm having trouble with the conditional logic. Is there an approach I'm overlooking. Rick ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.