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 strongm 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 onChange event to send data to another URL

Status
Not open for further replies.

michaelcoleman

Programmer
Jun 26, 2003
21
US
An Exerpt of my code looks like:

<form action=&quot;Exec.asp?prj=webSPC&cls=Report&quot; method=&quot;post&quot; >
TesterType:
<select name=&quot;testertype&quot; onChange=&quot;location='Exec.asp?prj=webSPC&cls=View2'&quot; >
<option value=Chassis>Chassis</option><option value=RCVR_BDC>RCVR_BDC</option>
</select>
<p>

When someone makes a selection of the option box, I would like to send the data to &quot;Exec.asp?prj=webSPC&cls=View2&quot; which happens to be the same page. (Using some ASP to talk to some VB code)

The problem is that this code only refreshes what's already there and doesn't seem to post the changed data. I've seen this done on websites, can't figure out how to do it.

Please Help :(

MJC
 
You're simply shanging the location rather than submitting the form. Try something along the lines of:
Code:
<script>
function doRedirect(strURL){
 var objSource = event.srcElement;
 var theForm = objSource.form;
 theForm.action = strURL;
 theForm.submit();
}
</script>
<form action=&quot;Exec.asp?prj=webSPC&cls=Report&quot; method=&quot;post&quot; >
TesterType: 
<select name=&quot;testertype&quot; onChange=&quot;doRedirect('Exec.asp?prj=webSPC&cls=View2');&quot;  >
     <option value=Chassis>Chassis</option><option value=RCVR_BDC>RCVR_BDC</option>
</select>

hope this helps.


[sub]Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
[/sub]
 
Thanks dude, you rock...I spent a lot of time trying to figure that out.
 
hey dwarf, i dont know how it solved the problem, but if its GET method a submit is same as location.href...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top