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

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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 17th, 2003, 05:50 AM
Spengos Spengos is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 5 Spengos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Adding values to a dynamic jump menu

Hi, I've writen the code below which displays a drop down select menu and can be displayed by writing the variable 'sjobs'. The code works fine as it is and the menu is populated with the requested info from the database ok. The problem I'm having is adding url links to the menu values.

Here's the code so far:

The script
<%
rs.open strsql3, conn
if NOT rs.EOF Then
sJobs=""
While Not rs.EOF
sJobs=sJobs &"<OPTION Value=""" &rs.fields("RefNum") &""" >" &rs.fields("RefNum") &"</OPTION>"
rs.movenext
Wend
else
sJobs="<option>No Records</option>"
End If
rs.close
%>

The Select Jump menu

<select onchange="if (this.selectedIndex > 0) location.href=this[this.selectedIndex].value;">
<option selected>Please Select</option>
<%=sJobs%>
</select>

The onchange event for the location.href works fine and when you select a value from the jump menu that value is attached to the url ok.

The problem I'm having is adding the following url to the values:
trans_list.asp?JobNum=rs("JobNum")&Name=rs("Name")
when I try to add this url to the Option Value above I keep getting errors such as 'expected end of statement' and 'syntax error'. The amount of quotes, double quotes and brackets was becoming too complicated and so I'm hoping someone can give me a hand with the syntax errors.
Any help would be appreciated.

Thanks, J

Reply With Quote
  #2  
Old July 17th, 2003, 09:35 AM
Spengos Spengos is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 5 Spengos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

Does anyone have any suggestions?

Reply With Quote
  #3  
Old July 17th, 2003, 10:17 AM
lordkyl lordkyl is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 27 lordkyl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
When writing code that is mixed with html, I find it easier to use this style:

Code:

<%
rs.open strsql3,conn
if not rs.eof then%>
     <select onchange="if (this.selectedIndex > 0) location.href=this[this.selectedIndex].value;"> 
     <option selected>Please Select</option> 
<%   while not rs.eof%>
          <option value="trans_list.asp?JobNum=<%=rs("JobNum")%>&Name=<%=rs("Name")%>"><%=rs("RefNum")%></option>
<%        rs.movenext
   wend
%>   </option>
<%else%>
     <option>No Records</option>
     </option>
<%end if%>


It might be a little confusing at first, but if you are using an editor that color codes asp functions and such, it is actually pretty nice to read and you don't have to worry about the quotes as much.

Reply With Quote
  #4  
Old July 18th, 2003, 02:38 AM
Spengos Spengos is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 5 Spengos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Lordkyl, I've got it working nicely now.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Adding values to a dynamic jump 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 3 hosted by Hostway