Hi all, I have a contact for that requires validating for a number of things. It validates Required for all parts of the form however fine.

My question is how can I ensure the client fills out the form fully. For instance, here in the UK we use 11 digits for phone numbers, but the form will validate if the clint enters just 1, so how can I ensure the customer actually enters all 11.

My question is how can I ensure the client fills out the form fully. For instance, here in the UK we use 11 digits for phone numbers, but the form will validate if the clint enters just 1, so how can I ensure the customer actually enters all 11.

You can get the digits from the telephone field using a regular expression, then check that it's the allowed length.

Ok Paul and as it Xmas get you head around this one. Some areas of the UK area use 10 or 11 digits?

It ought to be enough to check that...a) only digits are entered (strip non-digits for checking) - or allow only digits space hyphen in the input box onkeyup.b) first digit is 0c) total digits are 10 or 11.

Paul_Wilkins
—
2011-12-22T01:23:05Z —
#13

demontemplates said:

Ok Paul and as it Xmas get you head around this one. Some areas of the UK area use 10 or 11 digits?

It ought to be enough to check that...a) only digits are entered (strip non-digits for checking) - or allow only digits space hyphen in the input box onkeyup.b) first digit is 0c) total digits are 10 or 11.

After the function gets the digits, you can instead test it against a regular expression for what you need.In this case that would be starting with a zero, followed by 9 or 10 digits.

return /0\\d{9,10}/.test(digits);

demontemplates
—
2011-12-22T13:07:12Z —
#14

paul_wilkins said:

After the function gets the digits, you can instead test it against a regular expression for what you need.In this case that would be starting with a zero, followed by 9 or 10 digits.