Forum Moderators: open
Colleen
<script Language="JavaScript" type="text/javascript">
<!--
function validateEmpty(objcontrol)
{
var result = true;
//alert("hello world");
if (objcontrol.value == "" ¦¦ objcontrol == null){
objcontrol.focus();
objcontrol.select();
result = false;
}
return result;
}
function validateNumber(objcontrol)
{
var ValidChars = "0123456789.";
var result = true;
var Char;
var mystring = objcontrol.value
// alert(mystring.length);
for (i = 0; i < mystring.length && result == true; i++)
{
Char = mystring.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
alert("Please enter numbers only");
objcontrol.focus();
objcontrol.select();
result = false;
}
}
return result;
}
-->
</script>
<script type="text/javascript">
// note that language=javascript is deprecated
<!--
function validate(objcontrol)
{
var mystring = objcontrol.value
// first check
if (mystring == "" ¦¦ objcontrol == null){ // change the ¦¦ into solid pipes
alert("Please enter something");
objcontrol.focus();
objcontrol.select();
return false;
}
// second check, with some nice little regular expression pattern matching
var numbersOnly = /\d+/
if (!mystring.match(numbersOnly))
{
alert("Please enter numbers only");
objcontrol.focus();
objcontrol.select();
return false;
}
// we passed all the tests, so:
return true;
}
-->
</script>
<form name="searchResult2" action="../donewPermitSearch.asp" method=POST onSubmit="return validate(this.PermitNO)" >