Click to See Complete Forum and Search --> : dropdowns don't reset in IE


sanjuT
10-06-2003, 01:32 PM
I have 4 dropdowns on a page, they act like filters, the info on the page changes to what was selected in the dropdown.
Example of 2 of the dropdowns:




<form name="filtermenus" method="POST" action="Projectlist.asp">
&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp&nbsp;&nbsp;<b> <i>&nbsp;&nbsp;Developer</i>:</b>
<select name="developer" onchange = "PostForm();">
<%
response.Write ("<option value ='''>No Filter </option>")
if rsDeveloper.eof = false then
rsDeveloper.movefirst
while not rsDeveloper.eof
if len(developer)>0 then
if rsDeveloper("UserName") = (developer) then
selected = "Selected"
else
selected = ""
end if
end if
response.Write ("<option " & selected & " value ='" & rsDeveloper("UserName") & "'>" & rsDeveloper("UserName") & "</option>")

rsDeveloper.MoveNext
wend
end if
%>
</select>

&nbsp;&nbsp;&nbsp<b> <i>Priority</i>:</b>
<select name="priority" onchange = "PostForm();">
<%
response.Write ("<option value ='''>No Filter </option>")
rsPriority.movefirst
while not rsPriority.eof
if len(priority)>0 then
if rsPriority("priorityid") = cint(priority) then
selected = "Selected"
else
selected = ""
end if
end if
response.Write ("<option " & selected & " value ='" & rsPriority("PriorityID") & "'>" & rsPriority("Description") & "</option>")

rsPriority.MoveNext
wend
%>
</select>


I use this to reset the filters in Nestscape 4.76:


function resetfilter() {

document.filtermenus.developer.options[0].selectedIndex = 0;
document.filtermenus.priority.options[0].selectedIndex = 0;
document.filtermenus.status.options[0].selectedIndex = 0;
document.filtermenus.contact.options[0].selectedIndex = 0;


//PostForm();
window.location.reload();

}return true;



why doesn't this work in IE?
the page just reloads, after clicking 'retry', and the filters are unchanged.

THANKS!!

gil davis
10-06-2003, 02:54 PM
An OPTION does not have a selectedIndex property. That is a property of the SELECT tag. The only reason it works in Netscape is because of the "window.location.reload()". The syntax you should use is:
document.filtermenus.developer.selectedIndex = 0;
You should see the drop-down change as soon as you execute the statement. You should not need to reload the page just for that.