use client side code to trigger the load of page must use GET Protocol?

M

Matt

The following code is the drop down box, and when user changes the
selection, it will display the value of the selection automatically by the
onchange event. This code works fine with GET Protocol.

<html>
<body>
<form name="eventform" action="eventtest3.asp" method="GET">
<select name="id" onchange="location.href='eventtest3.asp?id='+this.value">
<option value="select">select</option>
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>
<%= Request.Querystring("id") %>
</form>
</body>
</html>

However, if I use POST protocol, it doesn't work anymore.

<html>
<body>
<form name="eventform" action="eventtest4.asp" method="POST">
<select name="id" onchange="location.href='eventtest4.asp'">
<option value="select">select</option>
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>
<%= Request.Form("id") %>
</form>
</body>
</html>

My question is: do we need to use GET protocol to trigger the reload of the
page?? Can I use POST protocol to accomplish the same task??


Please advise. Thanks!
 
B

Brynn

Even with the GET protocol ... you are not submitting the form in
either example.

You are not getting the GET one because of submission, you are getting
it because it is in the link ... that's all ... the form is not doing
anything.

what you want to do in EACH form is have ....

<select name="id" onchange="document.eventform.submit()">

placing this line in each sample should make both of them work. The
querystring for the first will be built by the form submission.

Brynn
www.coolpier.com


The following code is the drop down box, and when user changes the
selection, it will display the value of the selection automatically by the
onchange event. This code works fine with GET Protocol.

<html>
<body>
<form name="eventform" action="eventtest3.asp" method="GET">
<select name="id" onchange="location.href='eventtest3.asp?id='+this.value">
<option value="select">select</option>
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>
<%= Request.Querystring("id") %>
</form>
</body>
</html>

However, if I use POST protocol, it doesn't work anymore.

<html>
<body>
<form name="eventform" action="eventtest4.asp" method="POST">
<select name="id" onchange="location.href='eventtest4.asp'">
<option value="select">select</option>
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>
<%= Request.Form("id") %>
</form>
</body>
</html>

My question is: do we need to use GET protocol to trigger the reload of the
page?? Can I use POST protocol to accomplish the same task??


Please advise. Thanks!

I participate in the group to help give examples of code. I do not guarantee the effects of any code posted. Test all code before use!

Brynn
www.coolpier.com
 

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,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top