| NAMEDuration_of_Stay\" field.");
theForm.Duration_of_Stay.focus();
return (false);
}
if (theForm.Duration_of_Stay.value.length > 2)
{
alert("Please enter at most 2 characters in the \"Duration_of_Stay\" field.");
theForm.Duration_of_Stay.focus();
return (false);
}
var checkOK = "0123456789-.,";
var checkStr = theForm.Duration_of_Stay.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else if (ch == "," && decPoints != 0)
{
validGroups = false;
break;
}
else if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"Duration_of_Stay\" field.");
theForm.Duration_of_Stay.focus();
return (false);
}
if (decPoints > 1 || !validGroups)
{
alert("Please enter a valid number in the \"Duration_of_Stay\" field.");
theForm.Duration_of_Stay.focus();
return (false);
}
return (true);
}
//--> |