ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 24th, 2004, 05:56 PM
jaywilner jaywilner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 jaywilner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Help on keeping persistent variables in URL

Can someone please help me with a simple task in cold fusion. Here is what i cannot figure out:

I am trying to write a simple program to do the following:

Display a list of five items for selection. Once that item is selected, dont show it anymore in the list of items to select. Thus, as the items are selected, the page reloads and that item disappears. then you have four items left to select. then you select one of those, then the page reloads and you only have three,etc...

I am storing two name/value pairs in the URL:
the "choice" and the "item viewed". I then pass these variables to the template via the URL scope. The problem i am having is trying to figure out how to sequentially store the "items viewed" in the URL scope so that each time someone selects an item, that is appended to the "item viewed variable in the URL. Unfortunately, each time i do it, i store the current item viewed but lose the prior one.


A typical link that someone clicks on to make a choice is as follows:

<CFIF URL.Choice is 2>

<CFELSE>
<A HREF="assignment02.cfm?Choice=2">Item 2</A>
</CFIF>


I was thinking of something like this:

<CFIF URL.Choice is 2>

<CFELSE>
<cfoutput>
<A HREF="assignment02.cfm? Choice=1&ItemsViewed=#URL.ItemsViewed#&1">Item 1</A>
</cfoutput>

Any ideas? Thanks alot in advance.

jay wilner

Reply With Quote
  #2  
Old March 24th, 2004, 07:21 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,480 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 33 m 17 sec
Reputation Power: 42
Use a list and pass it as the URL variable:

<cfparam name="url.selectedItems" value="" />

<cfif not listFindNoCase( url.selectedItems, '1' )>
<a href="thispage.cfm?selectedItems=#listAppend( url.selectedItems, '1' )#">Item 1<a>
</cfif>

<cfif not listFindNoCase( url.selectedItems, '2' )>
<a href="thispage.cfm?selectedItems=#listAppend( url.selectedItems, '2' )#">Item 2<a>
</cfif>

etc...

Reply With Quote
  #3  
Old March 24th, 2004, 09:59 PM
jaywilner jaywilner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 jaywilner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
too complicated

hey, thanks alot for the reply, the only thing is, i havent studied that particular deal with the lists. All I have to work with is basic cold fusion tags like: CFIF, CFOUTPUT, CFSET, URL parameters. Got an easier, kindergarten level solution?

Reply With Quote
  #4  
Old March 25th, 2004, 08:39 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,480 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 33 m 17 sec
Reputation Power: 42
I suppose you could pass individual url variables, one for each element on the page that you don't want to display. But honestly, that approach is (to me at least) more complicated than using the list appraoch. This is because each link you create will have to know what other selections were also made and include them in the link. With the list you aleady have all of the elements that were picked in one variable.

Lists are very easy to understand, they are just strings with a delimiter (usually commas).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Help on keeping persistent variables in URL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway