Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript with jsp

Status
Not open for further replies.

aos

MIS
Feb 28, 2002
20
US
How do i use javascript validation for jsp page?
this is the validation code i have but when i change value in texbox, it wont submit:

<form name=&quot;add&quot; method=&quot;post&quot; action=&quot;/GSTS/servlet/com.fidelity.gift.gsts.servlet.GSTSControllerServlet&quot;>


<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function validate_Form()
{

var bid = window.document.add.bid.value;
if(bid == (&quot;&quot;))
{alert(&quot;Please enter bid price&quot;);
add.bid.select();
add.bid.focus();
return false;
}
else if(isNaN(bid) == true)
{alert(&quot;Please enter a correct bid price&quot;);
add.bid.select();
add.bid.focus();
return false;
}
var ask= window.document.add.ask.value;
if(ask == (&quot;&quot;))
{alert(&quot;Please enter ask price&quot;);
add.ask.select();
add.ask.focus();
return false;
}
else if(isNaN(ask) == true)
{alert(&quot;Please enter a correct ask price&quot;);
add.ask.select();
add.ask.focus();
return false;
}
var unit= window.document.add.unit.value;
if(unit == (&quot;&quot;))
{alert(&quot;Please enter unit price&quot;);
add.unit.select();
add.unit.focus();
return false;
}
else if(isNaN(unit) == true)
{alert(&quot;Please enter a correct unit price&quot;);
add.unit.select();
add.unit.focus();
return false;
}

}
</script>

<input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;submit&quot; onclick=&quot;validate_Form();return false;&quot;><input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;reset&quot;>


</body>

</html>
 
You might do better in javascript forum, rather than VB forum!
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top