The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
|
[\D,]+ digits and comma only validation - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18) +--- Thread: [\D,]+ digits and comma only validation (/showthread.php?tid=2735) |
[\D,]+ digits and comma only validation - johnbleck2 - Nov 20th, 2013 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? RE: [\D,]+ digits and comma only validation - johnbleck2 - Jan 14th, 2014 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: 1 1,2,3 10,20 Invalid: 1, or any "non number and comma" combination must end with number not comma RE: [\D,]+ digits and comma only validation - r.brandao - Sep 2nd, 2015 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 RE: [\D,]+ digits and comma only validation - r.brandao - Jan 28th, 2016 Lets go guys Up... any body help us? |