I am working on an existing function to validate the Object value is numeric and accept only COMMA Character.
Obj = 1,2,3,4,
However function is not giving any results ..
var checkOK;
if (isInt == true) {
checkOK = "0123456789";
}
else {
checkOK = "0123456789.";
}
for (i = 0; i < checkStr.value.length; i++) {
ch = checkStr.value.charAt(i);
for (j = 0; j < checkOK.length; j++) {
if (ch == checkOK.charAt(j)) {
if (isInt == true && j == 0) {
allValid = false;
break;
}
else {
break;
}
}
if (j == checkOK.length - 1) {
allValid = false;
break;
}
}
allNum += ch;
}
if (allValid==false)
{
alertsay = "Please enter only valid values "
alert(alertsay);
document.getElementById(obj.id).innerText="";
obj.focus();
return (false);
}