Solved

Storing Users Selections

Posted on 2003-11-28
6
154 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

15 Experts available now in Live!

Get 1:1 Help Now