|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Does anyone have any suggestions?
![]() |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
Thanks Lordkyl, I've got it working nicely now.
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Adding values to a dynamic jump menu |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|