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:
  #1  
Old February 14th, 2006, 02:54 PM
freaktroll freaktroll is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 47 freaktroll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 35 m 13 sec
Reputation Power: 3
Defining selection using session variables on a dropdown menu

Kinda complicated (at least for me at the moment)
I am using Session Variables to store information from my forms until the input proccess page, however, my trouble is when I try and populate the drop down menus with a selection from the session. Since the session stores an ID number which points to a description in another table, it will come back with the ID number instead of the actual descriptor name.

This is the code I used to use when I would just call it directly from the database (before I decided to use session variables to collect the data - I entered it step by step into the database).

getselectstyle is a query which relates the styleID (number) to the style (descriptor) within the style table, and insert is the db query which returns the styleID of the actual selection.

<cfif editmode><option value="#styleID#" <cfif (isDefined("listing.styleID") AND getselectstyle.styleID EQ listing.styleID)>selected="selected"</cfif>><cfoutput>#listing.style#</cfoutput></option></cfif>


Since the record is not in the database, but stored in the session, is there anyway to relate the styleID stored in the session with the descriptor name (style) and how?

Reply With Quote
  #2  
Old February 14th, 2006, 03:25 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,742 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 20 h 59 m 14 sec
Reputation Power: 62
I'm not clear on the actual problem. Why can't you either store the style name in the session scope along with the styleid, or run a query that pulls the style name from the database based on the styleid?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old February 14th, 2006, 04:39 PM
freaktroll freaktroll is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 47 freaktroll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 35 m 13 sec
Reputation Power: 3
Quote:
Originally Posted by kiteless
I'm not clear on the actual problem. Why can't you either store the style name in the session scope along with the styleid, or run a query that pulls the style name from the database based on the styleid?


I guess my problem is that Im not sure how to relay the style name along with the styleID. Since the form is relaying the ID upon the submit as the value, it can easily be picked up and stored. Im just not sure how to relate the name along with that unless I run another query based on the styleID which I didnt think would be the most effiecnt thing.

The only way I can think of would be to have a query relating the ID from the form (now being stored in the session) to the name- on the process page? I guess I would then have a cfset to put the query result into the session... is that the most efficent way though?

Reply With Quote
  #4  
Old February 14th, 2006, 05:06 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,742 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 20 h 59 m 14 sec
Reputation Power: 62
Efficiency is almost never the best reason to do something, unless you really need it (ie there will be a ton of load on the server). That said, if you are only passing the ID out from the form, and then storing that ID in the session scope, then there are really only two choices: execute another query on the next page to get the information on the passed ID, or load keep a cached version of the IDs and their related data in memory (probably application scope, but session if the ID data changes from user to user) and then you can "look up" the ID in your in-memory cache of the style information.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Defining selection using session variables on a dropdown menu


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT