Combo box value

T

TNG

Hi,

Question, I use often a combo box on my ASP pages.
each time a form is submitted, the value of the combo box returns to the
first selection
But is there a way to avoid this and show always your latest selection ?

Thx in advance

TNG
 
B

Bob Barrows [MVP]

TNG said:
Hi,

Question, I use often a combo box on my ASP pages.
each time a form is submitted, the value of the combo box returns to
the first selection
But is there a way to avoid this and show always your latest
selection ?
Thx in advance

Here's one way:

<%
dim selection, options
selection=request.form("cmb")
options="<option value='a'>A</option><option value='b'>" & _
"B</option><option value='c'>C</option>"
if len(selection) > 0 then
options = replace(options,"value='" & selection & "'", _
"value='" & selection & "' selected")
end if
%>
<html>
<body>
<form method="post">
<select name="cmb">
<%=options%>
</select>
<input type="submit">
</form></body></html>

HTH,
Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top