RE: I lost my brain - checkboxes

2002-10-07 Thread Margaret Fisk

You could do a second update as follows:

Update survey Set hot = 0 Where SID not in (10,17)

A warning though: A not in query only runs well on
well-indexed or small tables. If your table doesn't meet
those standards then you'd be better off getting the whole
list of SIDs as a list and removing the ones that were checked
then running the in statement with the remainder.

Margaret

-Original Message-
From: Tony Carcieri [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 07, 2002 10:39 AM
To: CF-Talk
Subject: I lost my brain - checkboxes


Hi all,

Sorry for the stupid post today but I cannot think.

I have an input field on a form:
input type=checkbox name=hotlead value=cfoutput#SID#/cfoutput
(SID is the primary key in the SQL 2K DB).

then on the page:
cfloop query=GetInfo
tr
tdinput type=checkbox name=hotlead
value=cfoutput#SID#/cfoutput cfif Hot EQ 1checked/cfif/td
/tr
/cfloop

So here is my problem. When a checkbox (or more) is checked, I do this SQL
statement:
UPDATE survey SET Hot = 1 WHERE SID IN (10,17) and this works great.
However, if I deselect the checkbox I no longer have the SID:
UPDATE survey SET Hot = 1 WHERE SID IN 0 (makes sense the value is the SID).

So how do I do this?
I want to set the Hot field to 1 on only the SID when checked and if i
deselect it, then i want the field to be set to 0 on the SID i deselect. The
default value in the Hot (bit) field is 0.

Thanks,
Tony


~|
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.



Re: I lost my brain - checkboxes

2002-10-07 Thread Bryan Stevenson

I always delete ALL previous selections from the DB and then insert the new
ones...that way everything stays current and the coding is dead simple.

HTH

Bryan Stevenson B.Comm.
VP  Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

-
Macromedia Associate Partner
www.macromedia.com
-
Vancouver Island ColdFusion Users Group
Founder  Director
www.cfug-vancouverisland.com
- Original Message -
From: Tony Carcieri [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Monday, October 07, 2002 10:39 AM
Subject: I lost my brain - checkboxes


 Hi all,

 Sorry for the stupid post today but I cannot think.

 I have an input field on a form:
 input type=checkbox name=hotlead value=cfoutput#SID#/cfoutput
 (SID is the primary key in the SQL 2K DB).

 then on the page:
 cfloop query=GetInfo
 tr
 tdinput type=checkbox name=hotlead
 value=cfoutput#SID#/cfoutput cfif Hot EQ 1checked/cfif/td
 /tr
 /cfloop

 So here is my problem. When a checkbox (or more) is checked, I do this SQL
 statement:
 UPDATE survey SET Hot = 1 WHERE SID IN (10,17) and this works great.
 However, if I deselect the checkbox I no longer have the SID:
 UPDATE survey SET Hot = 1 WHERE SID IN 0 (makes sense the value is the
SID).

 So how do I do this?
 I want to set the Hot field to 1 on only the SID when checked and if i
 deselect it, then i want the field to be set to 0 on the SID i deselect.
The
 default value in the Hot (bit) field is 0.

 Thanks,
 Tony

 
~|
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
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm



RE: I lost my brain - checkboxes

2002-10-07 Thread Everett, Al

I've done stuff where I also pass the universe of values as a hidden tag.

So if you have:

cfloop query=qry
 input type=checkbox name=hotlead value=cfoutput#SID#/cfoutput
/cfloop

I would also put:

input type=hidden name=listofleads
value=cfoutput#ValueList(qry.SID)#/cfoutput


Now on your next page you'll have the SIDs that are checked as well as all
the SIDs. Some simple list manipulation (and there are some good UDFs at
cflib.org for that) and you'll have all you need.



 -Original Message-
 From: Tony Carcieri [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 07, 2002 1:39 PM
 To: CF-Talk
 Subject: I lost my brain - checkboxes
 
 
 Hi all,
 
 Sorry for the stupid post today but I cannot think.
 
 I have an input field on a form:
 input type=checkbox name=hotlead 
 value=cfoutput#SID#/cfoutput
 (SID is the primary key in the SQL 2K DB).
 
 then on the page:
 cfloop query=GetInfo
 tr
 tdinput type=checkbox name=hotlead
 value=cfoutput#SID#/cfoutput cfif Hot EQ 1checked/cfif/td
 /tr
 /cfloop
 
 So here is my problem. When a checkbox (or more) is checked, 
 I do this SQL
 statement:
 UPDATE survey SET Hot = 1 WHERE SID IN (10,17) and this works great.
 However, if I deselect the checkbox I no longer have the SID:
 UPDATE survey SET Hot = 1 WHERE SID IN 0 (makes sense the 
 value is the SID).
 
 So how do I do this?
 I want to set the Hot field to 1 on only the SID when checked and if i
 deselect it, then i want the field to be set to 0 on the SID 
 i deselect. The
 default value in the Hot (bit) field is 0.
 
 Thanks,
 Tony
 
 
~|
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: I lost my brain - checkboxes

2002-10-07 Thread Tony Carcieri

Thanks everyone for your help! I appreciate it!

-Original Message-
From: Everett, Al [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 07, 2002 2:00 PM
To: CF-Talk
Subject: RE: I lost my brain - checkboxes


I've done stuff where I also pass the universe of values as a hidden tag.

So if you have:

cfloop query=qry
 input type=checkbox name=hotlead value=cfoutput#SID#/cfoutput
/cfloop

I would also put:

input type=hidden name=listofleads
value=cfoutput#ValueList(qry.SID)#/cfoutput


Now on your next page you'll have the SIDs that are checked as well as all
the SIDs. Some simple list manipulation (and there are some good UDFs at
cflib.org for that) and you'll have all you need.



 -Original Message-
 From: Tony Carcieri [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 07, 2002 1:39 PM
 To: CF-Talk
 Subject: I lost my brain - checkboxes


 Hi all,

 Sorry for the stupid post today but I cannot think.

 I have an input field on a form:
 input type=checkbox name=hotlead
 value=cfoutput#SID#/cfoutput
 (SID is the primary key in the SQL 2K DB).

 then on the page:
 cfloop query=GetInfo
 tr
 tdinput type=checkbox name=hotlead
 value=cfoutput#SID#/cfoutput cfif Hot EQ 1checked/cfif/td
 /tr
 /cfloop

 So here is my problem. When a checkbox (or more) is checked,
 I do this SQL
 statement:
 UPDATE survey SET Hot = 1 WHERE SID IN (10,17) and this works great.
 However, if I deselect the checkbox I no longer have the SID:
 UPDATE survey SET Hot = 1 WHERE SID IN 0 (makes sense the
 value is the SID).

 So how do I do this?
 I want to set the Hot field to 1 on only the SID when checked and if i
 deselect it, then i want the field to be set to 0 on the SID
 i deselect. The
 default value in the Hot (bit) field is 0.

 Thanks,
 Tony



~|
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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm