Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT OPTION LIST 1

Status
Not open for further replies.

laker67

Programmer
Jan 18, 2004
31
US
I have an ASP Page called test.asp which has the following code
<FORM name="myform">
<SELECT name="myselect" ONCHANGE="location = this.options[this.selectedIndex].value;">
<OPTION VALUE="test.asp" >ABC</OPTION>
<OPTION VALUE="test.asp?t=a">A</OPTION>
<OPTION VALUE="test.asp?t=b">B</OPTION>
</SELECT>
</FORM>


when the user selects an option it relaods the page with the request string which it is supposed to do .
Until here everything works fine .
But the the value of the option selected always goes back to the first option . Is there any way
i can preserve the option selected by the user.

I thoguht i could write a JavaScript function which sets the value to selected but not
sure how to do that . Any help is appreciated .

Thanks!!!!!!


 
Try this :
Code:
<FORM name="myform">
<SELECT name="myselect" ONCHANGE="location = this.options[this.selectedIndex].value;">
<OPTION VALUE="test.asp?"<%if isnull(request.querystring("t")) then response.write " selected"%>>ABC</OPTION>
<OPTION VALUE="test.asp?t=a"<%if request.querystring("t")="a" then response.write " selected"%>>A</OPTION>
<OPTION VALUE="test.asp?t=b"<%if request.querystring("t")="b" then response.write " selected"%>>B</OPTION>
</SELECT>
</FORM>
Should work fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top