I have an asp form which has a number of fields. On submit I want to check, using javascript that a tickbox has been selected and that an \’amount\’ field in within a given range AND has numbers only. I\’m struggling to get it to check all three in one go – at the mometn i have the following:
<script type=\"text/javascript\">
function validateForm()
{
var x=document.forms[\"myForm\"][\"Amount\"].value;
if (x<5 || x >250)
{
alert(\"Please complete all required fields - Amount you wish to save\");
return false;
}
else if ( myForm.agreesubmit.checked == false )
{
alert ( \"You Must Agree To The Terms and Conditions\" );
return false;
}
}
</script>
At the moment this is two seperate checks for tick box select and range.
Any ideas appreciated.





Rating:
The post forms – JavaScript – validate numeric only and within range appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/forms-javascript-validate-numeric-only-and-within-range.html
No comments:
Post a Comment