L
Larry S
hey all - i'd like to pass a value to a servlet, potentially from
multiple forms.
here's the trick - i want to give our designers a single block of code
for their forms and allow them to include the block without modifying
it at all. hence, there could be multiple form boxes on one page..
here's what i have so far, but it doesn't work - i think it's because
it doesn't like my use of 'this':
<script type="text/javascript" language="JavaScript1.2">
function redirect(form) {
return '<%=base%>/ndca/' + document.forms[form].searchterms.value;
}
</script>
<!--BEGIN SEARCH BOX-->
<form method="post" action="javascript:location.href =
redirect(this)">
<input name="searchterms" type="text" size="6" >
<input type="image" border="0" name="srch"
src="<%=fp_images%>/but_gosearch.gif" width="27" height="19"
alt="Search">
</form>
<!--AND A POSSIBLE OTHER SEARCH BOX (IDENTICAL CODING)-->
<form method="post" action="javascript:location.href =
redirect(this)">
<input name="searchterms" type="text" size="6" >
<input type="image" border="0" name="srch"
src="<%=fp_images%>/but_gosearch.gif" width="27" height="19"
alt="Search">
</form>
multiple forms.
here's the trick - i want to give our designers a single block of code
for their forms and allow them to include the block without modifying
it at all. hence, there could be multiple form boxes on one page..
here's what i have so far, but it doesn't work - i think it's because
it doesn't like my use of 'this':
<script type="text/javascript" language="JavaScript1.2">
function redirect(form) {
return '<%=base%>/ndca/' + document.forms[form].searchterms.value;
}
</script>
<!--BEGIN SEARCH BOX-->
<form method="post" action="javascript:location.href =
redirect(this)">
<input name="searchterms" type="text" size="6" >
<input type="image" border="0" name="srch"
src="<%=fp_images%>/but_gosearch.gif" width="27" height="19"
alt="Search">
</form>
<!--AND A POSSIBLE OTHER SEARCH BOX (IDENTICAL CODING)-->
<form method="post" action="javascript:location.href =
redirect(this)">
<input name="searchterms" type="text" size="6" >
<input type="image" border="0" name="srch"
src="<%=fp_images%>/but_gosearch.gif" width="27" height="19"
alt="Search">
</form>