RE: Multiple selections into a DB
I feel like I'm missing something there. Yes you are. Lets say your checkbox Name is myChkBox Once the user clicks submit your checkbox values will look like form.myChkBox=1,3,5,9,10 Now insert into the DB. cfloop index=i from=1 to=#listlen(form.myChkBox)# cfquery name=someQuery datasource= !--- You can use sessionid or cookie to identify user--- insert into SomeTable values (#sessionID#,#ListGetAt(form.myChkBox,i)#) /cfquery /cfloop Now your DB should look like Userid chkBoxValue 1 1 1 3 1 5 ... etc When user comes back to the page... you can compare the chkBoxValue to your DB values to turn on/off checkboxes Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 1:48 AM To: CF-Talk Subject: RE: Multiple selections into a DB Here's what I don't understand: As I update the db, it seems like you're telling me to input all 5 values at the same time, correct? If so, then I'll generate an error because of the comma delimited values that are trying to be pushed into a numeric field. I feel like I'm missing something there. Dont have any tutorials.. but i will try to explain it briefly. Let say you have a table with a unique identifier/userid/selections as (fields). Once you present the user with checkbox options, each checkbox has a unique id right? and all checkboxes have the same name When the user submits the form, you insert 5 selections into the Table with the above schema. When the user re-visits the same page, you show all the options.. except this time, you have to check the DB selections to turn on the checkboxes. cfset selections=valueList(QueryName.selections) input type=checkbox name=mychkBox value=10 cfif listFind(selections,10)checked/cfif Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:32 AM To: CF-Talk Subject: RE: Multiple selections into a DB I think I get what you're saying, but I've never done this before, so I'm a bit at a loss as to how to approach it. Tutorial? Outline? Example? Any would help! Thanks! -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 11:22 PM To: CF-Talk Subject: RE: Multiple selections into a DB You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene ~| 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 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 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Multiple selections into a DB
Did you get this working? Joe Eugene -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 3:53 AM To: CF-Talk Subject: RE: Multiple selections into a DB I feel like I'm missing something there. Yes you are. Lets say your checkbox Name is myChkBox Once the user clicks submit your checkbox values will look like form.myChkBox=1,3,5,9,10 Now insert into the DB. cfloop index=i from=1 to=#listlen(form.myChkBox)# cfquery name=someQuery datasource= !--- You can use sessionid or cookie to identify user--- insert into SomeTable values (#sessionID#,#ListGetAt(form.myChkBox,i)#) /cfquery /cfloop Now your DB should look like Userid chkBoxValue 1 1 1 3 1 5 ... etc When user comes back to the page... you can compare the chkBoxValue to your DB values to turn on/off checkboxes Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 1:48 AM To: CF-Talk Subject: RE: Multiple selections into a DB Here's what I don't understand: As I update the db, it seems like you're telling me to input all 5 values at the same time, correct? If so, then I'll generate an error because of the comma delimited values that are trying to be pushed into a numeric field. I feel like I'm missing something there. Dont have any tutorials.. but i will try to explain it briefly. Let say you have a table with a unique identifier/userid/selections as (fields). Once you present the user with checkbox options, each checkbox has a unique id right? and all checkboxes have the same name When the user submits the form, you insert 5 selections into the Table with the above schema. When the user re-visits the same page, you show all the options.. except this time, you have to check the DB selections to turn on the checkboxes. cfset selections=valueList(QueryName.selections) input type=checkbox name=mychkBox value=10 cfif listFind(selections,10)checked/cfif Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:32 AM To: CF-Talk Subject: RE: Multiple selections into a DB I think I get what you're saying, but I've never done this before, so I'm a bit at a loss as to how to approach it. Tutorial? Outline? Example? Any would help! Thanks! -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 11:22 PM To: CF-Talk Subject: RE: Multiple selections into a DB You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene ~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Multiple selections into a DB
Yes and no. I didn't get THIS working; I changed my approach to using dropdowns and simply grabbing the numeric value from them. From a user perspective, it still works nicely without complaint so far. Now, I'm just in testing--it's allowing users to choose RSS feeds and I'm working on verifying that the feeds are working/not generating errors so that they don't cause the pages to fail. Still working and working on that, that is. Thanks; I was planning on showing when I'm complete. Russ -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 11:48 PM To: CF-Talk Subject: RE: Multiple selections into a DB Did you get this working? Joe Eugene -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 3:53 AM To: CF-Talk Subject: RE: Multiple selections into a DB I feel like I'm missing something there. Yes you are. Lets say your checkbox Name is myChkBox Once the user clicks submit your checkbox values will look like form.myChkBox=1,3,5,9,10 Now insert into the DB. cfloop index=i from=1 to=#listlen(form.myChkBox)# cfquery name=someQuery datasource= !--- You can use sessionid or cookie to identify user--- insert into SomeTable values (#sessionID#,#ListGetAt(form.myChkBox,i)#) /cfquery /cfloop Now your DB should look like Userid chkBoxValue 1 1 1 3 1 5 ... etc When user comes back to the page... you can compare the chkBoxValue to your DB values to turn on/off checkboxes Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 1:48 AM To: CF-Talk Subject: RE: Multiple selections into a DB Here's what I don't understand: As I update the db, it seems like you're telling me to input all 5 values at the same time, correct? If so, then I'll generate an error because of the comma delimited values that are trying to be pushed into a numeric field. I feel like I'm missing something there. Dont have any tutorials.. but i will try to explain it briefly. Let say you have a table with a unique identifier/userid/selections as (fields). Once you present the user with checkbox options, each checkbox has a unique id right? and all checkboxes have the same name When the user submits the form, you insert 5 selections into the Table with the above schema. When the user re-visits the same page, you show all the options.. except this time, you have to check the DB selections to turn on the checkboxes. cfset selections=valueList(QueryName.selections) input type=checkbox name=mychkBox value=10 cfif listFind(selections,10)checked/cfif Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:32 AM To: CF-Talk Subject: RE: Multiple selections into a DB I think I get what you're saying, but I've never done this before, so I'm a bit at a loss as to how to approach it. Tutorial? Outline? Example? Any would help! Thanks! -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 11:22 PM To: CF-Talk Subject: RE: Multiple selections into a DB You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene ~| 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 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 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Multiple selections into a DB
You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:03 AM To: CF-Talk Subject: Multiple selections into a DB I've got a problem to solve and I feel I'm a big portion of the way there, but I need a little insight into my madness to see how far off I am and to see if there's an alternate route I should be heading. I have a table in my db that provides me with a listing of 15 items. I display those on a page with a checkbox next to them after polling the table in the db. Right now, those checkboxes have a value associated with them that is their AutoNum ID in the db. A user, when seeing this page can choose upto 5 of these options, but no more. There are 5 fields(Field1 ... Field5) in the db that accept these values that are selected. Here's the issues that I'm trying to overcome: How do I know which of my checkboxes that are selected go into Field1, etc.? How do I address the SQL issue of saying these checkboxes should be checked when the user revisits this page? Those are the big issues--I might be OT here, and I apologize for that. Any thoughts? Thanks, Russ ~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Multiple selections into a DB
I think I get what you're saying, but I've never done this before, so I'm a bit at a loss as to how to approach it. Tutorial? Outline? Example? Any would help! Thanks! -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 11:22 PM To: CF-Talk Subject: RE: Multiple selections into a DB You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene ~| 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 Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Multiple selections into a DB
Dont have any tutorials.. but i will try to explain it briefly. Let say you have a table with a unique identifier/userid/selections as (fields). Once you present the user with checkbox options, each checkbox has a unique id right? and all checkboxes have the same name When the user submits the form, you insert 5 selections into the Table with the above schema. When the user re-visits the same page, you show all the options.. except this time, you have to check the DB selections to turn on the checkboxes. cfset selections=valueList(QueryName.selections) input type=checkbox name=mychkBox value=10 cfif listFind(selections,10)checked/cfif Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:32 AM To: CF-Talk Subject: RE: Multiple selections into a DB I think I get what you're saying, but I've never done this before, so I'm a bit at a loss as to how to approach it. Tutorial? Outline? Example? Any would help! Thanks! -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 11:22 PM To: CF-Talk Subject: RE: Multiple selections into a DB You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene ~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Multiple selections into a DB
Here's what I don't understand: As I update the db, it seems like you're telling me to input all 5 values at the same time, correct? If so, then I'll generate an error because of the comma delimited values that are trying to be pushed into a numeric field. I feel like I'm missing something there. Dont have any tutorials.. but i will try to explain it briefly. Let say you have a table with a unique identifier/userid/selections as (fields). Once you present the user with checkbox options, each checkbox has a unique id right? and all checkboxes have the same name When the user submits the form, you insert 5 selections into the Table with the above schema. When the user re-visits the same page, you show all the options.. except this time, you have to check the DB selections to turn on the checkboxes. cfset selections=valueList(QueryName.selections) input type=checkbox name=mychkBox value=10 cfif listFind(selections,10)checked/cfif Joe Eugene -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:32 AM To: CF-Talk Subject: RE: Multiple selections into a DB I think I get what you're saying, but I've never done this before, so I'm a bit at a loss as to how to approach it. Tutorial? Outline? Example? Any would help! Thanks! -Original Message- From: Joe Eugene [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 11:22 PM To: CF-Talk Subject: RE: Multiple selections into a DB You might want to just insert the checkbox values into one field rather than having 5 fields for 5 selections. Once you re-display the page.. you can check these selection ids against your display ids... Its late! hope you get the idea. Joe Eugene ~| 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 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4