Web Layout
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignWeb Layout

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 ASP Free Forums Sponsor:
  #1  
Old June 3rd, 2005, 09:12 AM
sickmusic sickmusic is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 sickmusic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 9 sec
Reputation Power: 0
Multiple Values from single Drop Down Selections.

Hi,
Hope you're all well.

Problem:
- Environment ASP/VB/IIS/SQL Server
- I have a drop down menu that is populated using a DB query.
- The DB Query returns two values that constructs the drop down.
- An ID which is used for the value="" of the option tag
- A Name which is Displayed on the browser's drop down selection list.

Code:
			Response.Write "<OPTION value='"
			Response.Write Session("RS")("ID") & "'"
			Response.Write ">"
			Response.Write Session("RS") ("NAME")
			Response.Write "</OPTION>"			
			Session("RS").MoveNext

The output looks something like this:
Code:
<SELECT name="NAMEZ">
<OPTION value='119'>Jack</OPTION>
<OPTION value='120'>Mack</OPTION>
<OPTION value='175'>Raq</OPTION>
<OPTION value='174'>Crack</OPTION>
</SELECT>

The selected option is posted through an HTML form through to a Results.asp page where various operations take place.

Now, there is a requirement that Results.asp has to display the Parameters at the top of the Page, and believe it or not the drop downs are included.
Code:
Request.Form("NAMEZ")

Will return an ID. Unfortunatly, its meaningless to the end user.

I've searched around for a few days, and could not find an easy way to grab the contents between the <option></option> tags, and have been thinking of going through desperate measures:

Desperate Measure 1:

Code:
			Response.Write "<OPTION value='"
			Response.Write Session("RS")("ID") & "XXX" & Session("RS") ("NAME") & "'"
			Response.Write ">"
			Response.Write Session("RS") ("NAME")
			Response.Write "</OPTION>"			
			Session("RS").MoveNext

Whereby, on Results.asp following a:
Code:
Request.Form("NAMEZ")

I will perform a split operation by and splitting the NAMEZ value into an Array
Code:
arrayNamez = Split(Request.Form("NAMEZ"),"XXX")


Desperate Measure 2:

- onSelect of an item in the drop down, the form is submitted to the same page.
- on the Second Load of the .asp page a Database query will store both ID and Names into Hidden form variables.

Desperate Measure 3:

- A DB query is performed on Results.asp to re - retrieve the NAME from the DB.

Conclusions:

On what the best approach is, as well as alterantives are welcome.
Many thanks for reading.

Reply With Quote
  #2  
Old June 3rd, 2005, 11:43 AM
jmurrayhead's Avatar
jmurrayhead jmurrayhead is offline
The Drunken Moderator
Click here for more information.
 
Join Date: Feb 2004
Location: Reston, VA, USA
Posts: 13,061 jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 81609 Folding Title: Advanced FolderFolding Points: 81609 Folding Title: Advanced FolderFolding Points: 81609 Folding Title: Advanced FolderFolding Points: 81609 Folding Title: Advanced FolderFolding Points: 81609 Folding Title: Advanced Folder
Time spent in forums: 3 Months 6 Days 12 h 26 m 32 sec
Reputation Power: 1576
Facebook
I myself have had no problems with desperate measures 1 or 3. I think they are both good ways of doing what you want it to do. I'm more favorable for measure one. In my opinion, it takes less time for me to insert that little bit of code rather than doing a whole new query on the results page to get the same result. Just my opinion though.

Reply With Quote
  #3  
Old June 6th, 2005, 10:49 AM
sickmusic sickmusic is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 sickmusic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 38 m 9 sec
Reputation Power: 0
cheers,

needed a second opinion just incase there was an easier way.

gone for measure one.. dont seem so desperate now

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignWeb Layout > Multiple Values from single Drop Down Selections.


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 4 hosted by Hostway