Hi there
I am setting up a text search with 3 search buttons to allow 3 different searches from the one text box. Each search has different values for the 2 hidden elements. So far I've got the 3 submit buttons working with the below code but I can't figure how to get the hidden values to be inserted. For each of the 3 different submits I need to tell javascript what the 2 hidden values are. Can anyone help me?
<SCRIPT language="JavaScript">
function OnSubmitForm()
{
if(document.pressed == 'questions')
{
document.myform.action ="/search.php"
}
else
if(document.pressed == 'rankings')
{
document.myform.action ="news/search.php";
}
else
if(document.pressed == 'courses')
{
document.myform.action ="forum/search.php";
}
return true;
}
</SCRIPT>
<FORM name="myform" method="GET" onSubmit="return OnSubmitForm();">
<input name="query" id="query" type="text" size="40" />
<input type="hidden" name="hidden1" value = "" />
<input type="hidden" name="hidden2" value = "" />
<INPUT TYPE="SUBMIT" name="submit" onClick="document.pressed=this.value" VALUE="questions">
<INPUT TYPE="SUBMIT" name="submit" onClick="document.pressed=this.value" VALUE="rankings">
<INPUT TYPE="SUBMIT" name="submit" onClick="document.pressed=this.value" VALUE="courses">
</FORM>
Thanks a lot for any advice