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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option selected

Status
Not open for further replies.

Philbot

Programmer
Mar 24, 2003
4
GB
Please help this is doing my nut in!!

I have a lsit box where people choose then post as a form

Once the page has posted I want thier selection to show in the list box.

Here is what I have:

<option value=&quot;scheduled&quot;>Scheduled</option>
<option value=&quot;Completed&quot;>Completed</option>
<option selected=&quot;Ovedue&quot;>Overdue</option>
<%if Strstatus <>&quot;&quot; then%>
<option selected=<%=StrStatus%>>=<%=StrStatus%></option>
<%end if%>
</select></td>

It all works fine apart from the fact I end up with a duplicate in the list box, I have tried removing the 2nd ref to StrStatus but then the list box doesnt populate until i click the drop down?

how someone can help Ive blown up Google I think!!
 
try
<option value=&quot;scheduled&quot;>Scheduled</option>
<option value=&quot;Completed&quot;>Completed</option>
<%
if Strstatus <> &quot;&quot; then
%>
<option SELECTED><%=StrStatus%></option>
<option value=&quot;Ovedue&quot;>Overdue</option>
<%
else
%>
<option value=&quot;Ovedue&quot; SELECTED>Overdue</option>
<%
end if
%>
</select></td>

I'm not real sure of what your doing but I think that may be it. eg: SELECTED is a stand alone attribute

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
well the default when they open the page is Ovedue.

But if they click scheduled then it should come back with scheduled selected and only have overdue and completed in the drop down.
If they had selected completed I would wwant to have scheduled and overdue in the drop down box.
So I dont think the suggestion you offered would work because if they selected scheduled I obviously get scheduled selected in the box after posting but when I check the drop down box is also has:-
scheduled
Com
scheduled
Ovedue

i.e. scheduled is now in 3 times?

 
response.write &quot;<select><option&quot;
if StrStatus = &quot;Scheduled&quot; then
response.write &quot; selected &quot;
end if
response.write &quot;>Scheduled</option>&quot;
response.write &quot;<option&quot;
if StrStatus = &quot;Completed&quot; then
response.write &quot; selected &quot;
end if
response.write &quot;>Completed</option>&quot;
response.write &quot;<option&quot;
if StrStatus = &quot;Overdue&quot; or StrStatus=&quot;&quot; then
response.write &quot; selected &quot;
end if
response.write &quot;>Overdue</option></select>&quot;




hth,
Foxbox
ttmug.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top