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

how to make the page redirect from user drop down choice?

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
PT
i have a page that has a drop down and when the user cooses one of the fields on that drop down i want the page to reload in order to update the query and populate another drop down with related fields in the DB, can anyone help me?

Thanks in advance

Herminio,Portugal
 
Use the onChange event on the select tag to
1) Change the action attribute of the form to point at the current page instead of the final processing page
Code:
formname.action="thispage.asp";
2) submit the form
Code:
form.submit();

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Can you be more specific?
this is what i have

<script language=&quot;JavaScript&quot;>
<!--
function goto() {
document.all.catg.cat.action=&quot;criarpoll.asp?id=<%= cat('idcat') %>&quot;;
}
//-->
</script>

<form name=&quot;catg&quot; method=&quot;POST&quot; action=&quot;criada.asp&quot;>

<input name=&quot;status&quot; type=&quot;hidden&quot; value=&quot;0&quot;>

<p> Categorias<br>
<select name=&quot;cat&quot; size=&quot;1&quot;>
<%
While NOT cat.EOF
%>
<option value=&quot;<%=cat(&quot;IdCat&quot;)%>&quot; onChange=&quot;goto()&quot;><%=cat(&quot;Categoria&quot;)%></option>
<%
cat.MoveNext()
Wend
%>
</select>
</p>
<p>Sub Categorias<br>
<select name=&quot;subcat&quot; size=&quot;1&quot;>
<%
While NOT subcat.EOF
%>
<option value=&quot;<%=subcat(&quot;IdSubCat&quot;)%>&quot;><%=subcat(&quot;SubCategoria&quot;)%></option>
<%
subcat.MoveNext()
Wend
%>
</select>
 
HELP!!!!! please, can someone take a look at my code and tell me if i'm doying things the wright way?
 
Place the onChange inside your select tag instead of your option tag, the select is the container that fires the events, the options are merely list items.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top