Menu
I’m doing some string checks for a form validation. Now i have to make sure a certain field is 13 digits long, only digits and it can only be 13 characters. This is the code I use for it:
[code=html] [‘validate-phone’, ‘Please use a phonenumber including country code, for example: 0031642391466’, function(v) {
return Validation.get(‘IsEmpty’).test(v) || !/[^d]/.test(v);
}],
It works to get only digits, but I haven’t figured out how to check for the length of the string yet. I have tried a lot of things but I can’t seem to get it to work. How do I build in this check?