K
KathyB
Hi,
I just can't get this quite right. I use the following function to
validate a user entry. I need to allow negative numbers including
those with decimals (e.g., -.5). The following allows the decimals but
not the negative. Any help appreciated...as always. Thanks -- Kathy
function ValidateSave(formRef,fieldName,min,max) {
var formField = formRef.elements[fieldName];
if (!/^\d+(\.\d+)?$/.test(formField.value)) {
alert('Invalid entry...please try again!');
formField.focus();
formField.select();
return false;
}
I just can't get this quite right. I use the following function to
validate a user entry. I need to allow negative numbers including
those with decimals (e.g., -.5). The following allows the decimals but
not the negative. Any help appreciated...as always. Thanks -- Kathy
function ValidateSave(formRef,fieldName,min,max) {
var formField = formRef.elements[fieldName];
if (!/^\d+(\.\d+)?$/.test(formField.value)) {
alert('Invalid entry...please try again!');
formField.focus();
formField.select();
return false;
}