Solved

Storing Users Selections

Posted on 2003-11-28
6
157 Views
Last Modified: 2013-12-24
I developed a form that shows my database contents, with a check box next to each row. I want the user to be able to select multiple rows (via checkbox), submit the selections; the submissions will be added to a cart and the user can continue browsing to other categories and add more rows from other pages to the cart. The user will then view his/her cart and finally submit their selections via cfmail form to an administrator. Any suggestions?

0
Comment
Question by:zakirdavis
6 Comments
 

Author Comment

by:zakirdavis
ID: 9839356
BTW, my checkboxes are dynamically named by the primary key of each row. I know this will help in identifying the properties. Any tips or recommendations would be helpful. I am not sure how to design this. Using structures, arrays, store information in another table that expires over time....
0
 
LVL 9

Accepted Solution

by:
svenkarlsen earned 500 total points
ID: 9839376
Hi zakirdavis,
Make a separate selection dataset with fields:

UserID, RecordID

When user enters database, clear all records for that user in the selection dataset

use a query as source for your for your form, linking on the RecordID and filtering on UserID

for the checkbox, make the code add a record to the selection dataset with UserID and RecordID when checked, and attempt to delete same record when unchecked

Kind regards,
Sven
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9841457
I guess i had commented your previous comments on the same question u have asked 3rice in last week.

pls stick to one thread - rather than opening multiple ones with the same question in it !!!
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 17

Expert Comment

by:Tacobell777
ID: 9841494
You could store the user selections in the session scope once the form is submitted, for example if the session did not yet exist you could do something like
<cfset session.cart = duplicate(form)>
This would copy all values submitted into the session scope, if the user would submit another form (the session would exist already at this stage) you would append the values to the existing session
<cfset structAppend(session.cart, form)> (I believe this is the right syntax)
you would need to be careful because an append can overwrite your existing values if they are named the same.

This will get you going anyway...
0
 
LVL 4

Expert Comment

by:procept
ID: 9841740
Hi,

a table can not automatically expire over time. If you use a session var, you need to check for it's existance every time you access it (because it won't exist if it's expired). You can set a timestamp to manually expire tables, vars, etc.

BTW. name your checkboxes all the same! Give them unique values, not individual names! It's much easier to handle selected values this way:

<!--- if the user selected at least one checkbox --->
<cfif isDefiend("form.myCheckBox")>
   <!--- loop over selected items --->
   <cfloop list="#form.myCheckBox#" index="idx">
      <!--- do whatever you need to do with the item --->
   </cfloop>
</cfif>

HTH,

Chris
0
 

Author Comment

by:zakirdavis
ID: 9841760
thanks for the input. i am tired and will accept an answer tomorrow. as for the multiple posts, it is a three part question, so i figured to ask each part of it in different questions. I didnt want people to think it was too much to answer in one question. thanks for the input.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New OSQA server has a ton of fake users 4 71
Website URL redirection 10 73
whm high memory usage in processes 7 103
WebSite Direction 1 54
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question