Click to See Complete Forum and Search --> : how to call a javascript function when in multiple form


verybrightstar
04-10-2003, 04:51 AM
i have this code
function Check()
{
//If is not empty is true
return true
//else
return false

}


</script>

<form action="TestSubmit.asp" method="post" name="f">
<input type = "text" name="TEST3" value = "T1"><br>
<input type = "text" name="TEST4" value = "T2"><br>
<input type="button" onClick="this.form.action='TestSubmit.asp';this.form.submit()" value = "test3">
<input type="button" onClick="this.form.action='TestSubmit1.asp';this.form.submit()" value = "test4">
<input type="button" onClick="this.form.action='http://localhost/cnafinal/ADMIN_TEST.asp?AID=731&SID=8849993935';this.form.submit()" value = "Search">
<input type="button" onClick="this.form.action='http://www.yahoo.com';return Check()" value = "test5" id=button1 name=button1>
</form>

this is only sample piece of code i want to test, how can i validate the form when i click on the button test5, if validations is true then go to the http://www.yahoo.com else
remain intact, can anyone show me an example

verybrightstar
04-10-2003, 08:09 AM
I would like to validate the below textbox for TEST3 is it like this
i have this code
function Check()
{
//If is not empty is true
if(document.f.TEST3.value != "")
{
return true
}
//else
return false

}


</script>

<form action="TestSubmit.asp" method="post" name="f">
<input type = "text" name="TEST3" value = "T1"><br>
<input type = "text" name="TEST4" value = "T2"><br>
<input type="button" onClick="this.form.action='TestSubmit.asp';this.form.submit()" value = "test3">
<input type="button" onClick="this.form.action='TestSubmit1.asp';this.form.submit()" value = "test4">
<input type="button" onClick="this.form.action='http://localhost/cnafinal/ADMIN_TEST.asp?AID=731&SID=8849993935';this.form.submit()" value = "Search">
<input type="button" onClick="this.form.action='http://www.yahoo.com';return Check()" value = "test5" id=button1 name=button1>
</form>