pass value from potentially multiple forms to one servlet

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>
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top