PDA

View Full Version : drop down lists


PeterM
06-10-2003, 10:29 PM
I want to produce drop down lists that when selected and the page is refreshed the selected item is the value that appears in the drop down list.

As an example if go to any jump point on this web site, select an option... when the screen refreshes the drop down list shows the jump point you have arrive at as the value.

Can some help, thanks

Frank
06-10-2003, 11:20 PM
Here is a link that might be useful to you:

http://javascript.internet.com/navigation/menu-automatic.html

HTH
Frank

PeterM
06-10-2003, 11:39 PM
Thanks Frank, but this is not quite what I'm after.

I have created a little calculator using ASP which has 2 pages...

Page 1 collects one piece of information to use in calculating - ie. number of employees.

Page 2 does the calculating on a number of options if a checkbox for any one option is selected. Very basic maths etc.

When you check a box/s you then click on the Submit button to complete the calculation.

In this page is an additional option to add an item that is NOT calculated based on employee number.

I have set up a drop down list with defined options which, provided the option is checked, will return the appropriate value.

This all works fine except... after you've calculated (ie. clicked the submit button) the dropdown list option defaults back to the first option in the option list - which is "please select".

This is ok, but if you changed another option and click submit, the page now assumes you have selected "please select" and calculates zero. I want the drop down box to hold the option selected previously.

PeterM
06-11-2003, 02:41 PM
Can anyone help... I'm getting a bit desperate.

Angelika
06-11-2003, 02:58 PM
Where is your code?

PeterM
06-11-2003, 03:35 PM
There are 2 files qstepone.asp, qsteptwo.asp

these are attached

Angelika
06-12-2003, 11:27 AM
try this:

<!-- Option 3 Add Extra Questions -->
<tr>
<td width="10%" align="center" height="1">
<font face="Verdana">
<input type="checkbox" name="Optn3" value="ON" tabindex="3"
<%
If Request.Form("Optn3") = "ON" Then
Response.Write " checked=""checked"""
End If
%>
></font></td>
<td width="72%" height="1"><font face="Verdana" size="2">Option 3 - Add Extra Questions&nbsp;</font><a href="javascript:popUp('../qsns.asp')"><font face="Verdana" size="1" color="#0000FF">[DETAILS]</font></a><font face="Verdana" size="1">
<br>
<%AddNumQsns=request.form("AddNumQsns")
%>
<select size="1" name="AddNumQsns">
<%
IF AddNumQsns="add10" Then
%>
<option value="Select">Select Range of additional Questions</option>
<option Selected value="add10">Up to 10 additional questions</option>
<option value="add20">11 to 20 additional questions</option>
<option value="add50">21 to 50 additional questions</option>
<option value="addmore">More than 50 Questions (Call Us)</option>
<%
ElseIF AddNumQsns="add20" Then
%>

<option value="Select">Select Range of additional Questions</option>
<option value="add10">Up to 10 additional questions</option>
<option Selected value="add20">11 to 20 additional questions</option>
<option value="add50">21 to 50 additional questions</option>
<option value="addmore">More than 50 Questions (Call Us)</option>

<% ElseIF AddNumQsns="add50" Then%>

<option value="Select">Select Range of additional Questions</option>
<option value="add10">Up to 10 additional questions</option>
<option value="add20">11 to 20 additional questions</option>
<option Selected value="add50">21 to 50 additional questions</option>
<option value="addmore">More than 50 Questions (Call Us)</option>


<%
ElseIF AddNumQsns="addmore" Then

%>
<option value="Select">Select Range of additional Questions</option>
<option value="add10">Up to 10 additional questions</option>
<option value="add20">11 to 20 additional questions</option>
<option value="add50">21 to 50 additional questions</option>
<option Selected value="addmore">More than 50 Questions (Call Us)</option>
<%Else%>

<option Selected value="Select">Select Range of additional Questions</option>
<option value="add10">Up to 10 additional questions</option>
<option value="add20">11 to 20 additional questions</option>
<option value="add50">21 to 50 additional questions</option>
<optionvalue="addmore">More than 50 Questions (Call Us)</option><%End If%>
</select></font>
</td>
<td width="18%" align="right" height="1">
<font size="2" face="Verdana">&nbsp;
<!-- AddQsns Calculation -->

PeterM
06-12-2003, 02:49 PM
Hi,

Thanks for the code.

I have nutted it out and used a slightly different ASP solution which I prefer.

Here is the code for those who are interested... It basically has a piece of ASP code within each each "option" value.


<select size="1" name="AddNumQsns">
<option selected value="Select">
Select Range of additional Questions
</option>

<option value="add10"
<%
If Request.Form("AddNumQsns") = "add10" Then
Response.Write " selected=""selected"""
End If
%>
>Up to 10 additional questions
</option>

<option value="add20"
<%
If Request.Form("AddNumQsns") = "add20" Then
Response.Write " selected=""selected"""
End If
%>
>11 to 20 additional questions
</option>

<option value="add50"
<%
If Request.Form("AddNumQsns") = "add50" Then
Response.Write " selected=""selected"""
End If
%>
>
21 to 50 additional questions
</option>

<option value="addmore"
<%
If Request.Form("AddNumQsns") = "addmore" Then
Response.Write " selected=""selected"""
End If
%>
>
More than 50 Questions (Call Us)
</option>
</select>