i am trying to write a validator which could validate the bunch of commas like (,,,,,,,,,)
if single comma(,) is there then its ok .
here is my code
function test() {
var iChars = ",,";
for (var i = 0; i < document.mform.show_time1.value.length; i++) {
if (iChars.indexOf(document.mform.show_time1.value.charAt(i)) != -1) {
alert("The box has special characters. \nThese are not allowed.\n");
return false;
}
}
}
but the above script is also validating (,) that i don’t want .
Any idea how to do that ??
are you trying to find out string which has multipe ,,,, in it
For Example
then your test() function should be something like this.
I hope this helps, or please clarify the question once again.