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
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;

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?

Instead of writing a new rule in the rsv I utilized reg_exp

rules.push("reg_exp,Sec1_Color_Pages_List,^[0-9]+(?:\\,[0-9]+)*$,Color Page list must have format of number comma number in Section 1")

The reg_exp of ^[0-9]+(?:\\,[0-9]+)*$
did the trick.

valid strings:

Invalid: 1,
or any "non number and comma" combination must end with number not comma
I need to do something in the field should be input only a value between 18 and 70 , I do not know where to do it. Tried putting range = 18-70 in the Custom Function but it did not work
Lets go guys Up... any body help us?

Forum Jump:

Users browsing this thread: 1 Guest(s)