Web directory - Debt Consolidation - Web Hosting - Find jobs - Debt Consolidation

PDA

View Full Version : Onchange with Post


cyclopsvs
Aug 10th 2006, 7:55 am
Hello javascript users,

I'm a newby in web programming and i'm wondering if the following can be done. I have a select box in a form with multiple choises and the action of every choise will go to a different url.

my question is if it's possible to take along all the pre defined variables to the next url, just like a post method from a form would do.

the syntax i have till now is this:

<form name='screening' action="http://anewpage" method="post">
<table>
<tr valign='baseline'>
<td nowrap align='left'>Normal plasma:</td>
<td><input type='text' name='rrf_la' size='15'></td>
</tr>

<tr valign='baseline'>
<td align="left" valign="top">Type of assay:</td>
<td>
<select name='ass_la' WIDTH='150' STYLE='width: 150px' ONCHANGE='location = this.options[this.selectedIndex].value;'>
<option value='http://APTT'>APTT</option>
<option value='http://DRVVT'>DRVVT</option>
</select>
</td>
</tr>
</table>
</form>


any suggestions would be appreciated,

richard mendes

mad4
Aug 10th 2006, 7:58 am
So you are wanting to pass the "rrf_la" variable to the new page "http://DRVVT" for example? Or just redirect to http://DRVVT?

cyclopsvs
Aug 10th 2006, 8:18 am
Indeed i want to pass that variable and some others to the page http://DRVVT

mad4
Aug 10th 2006, 8:24 am
Try something like this:
<script language="JavaScript">
<!--
function yourfunction(yourform){
yourform.action = "http://www.newpage.com/page.htm?variable=" + yourform.somevariable.value + "";
return true;
}
//-->
</script>
<input type="button" value="Submit" onclick="yourfunction();">

cyclopsvs
Aug 10th 2006, 8:45 am
Ok thanks that helps a lot