Hi there Gurus.
I seem to have a problem in FIREFOX which does not appear in IE.
Basically, I am trying to validate a form has only 10 numbers entred into the field (no spaces or any other characters). The following script works perfectly in IE but no dice in FIREFOX. It doesn't generate any errors in Firefox, it just seems to default to false and says that the I still have to enter 10 digits where I HAVE ALREADY !
Please help.
Script as follows ...
<SCRIPT LANGUAGE="JavaScript1.2">
function digitvalidation(entered, min, max, alertbox, datatype)
{
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(1)=="i")
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}
function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}
function formvalidation(thisform)
{
with (thisform)
{
if (digitvalidation(thenumber,10,10,"You MUST enter a 10 digit number","I")==false)
{
thenumber.focus();
return false;
// ALWAYS SEEMS TO BE FALSE IN FIREFOX ??!?!
} else if (!terms.checked) {
alert("Tick the terms box.");
return false;
} else if (naw.value=="none") {
alert("Select an option.");
return false;
}
}
}
</script>