Solved

Storing Users Selections

Posted on 2003-11-28
6
153 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to add time taken to serve the request in ms in apache log configuration? 6 72
Script 12 137
LAMP problem identifier tool ? 9 110
New OSQA server has a ton of fake users 4 55
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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 …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now