FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[\D,]+ digits and comma only validation
#1
I added a case to the rsv.js but I'm just not getting the regexp right.
The field needs to have just numbers and commas.
These numbers can range from 1-900.

case "digitscommas_only":
if (form[fieldName].value && form[fieldName].value.match(/[\D,]+/))
{
if (!rsv.processError(form[fieldName], errorMessage))
return false;
}
break;

I thought I'd keep it simple with just Digits and comma range, but I'm missing something.

value.match(/[\D,]+/)) is allowing only digits, put a comma in the field and it fails. I tried the unicode variation as well [\D\U+002C]+
I also tried (/[\D\%%C%%]+/)) since the commas are replaced with %%C%% earlier on in the rsv.js, but I believe they are back by this point in the validation function.

[\D,]+ seemed pretty obvious. what am I missing?


Reply


Messages In This Thread
[\D,]+ digits and comma only validation - by johnbleck2 - Nov 20th, 2013, 5:07 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)