French number restriction

Hi community!
We want to increase leads’ conversion rate on our form.
For this we would like to receive only tel numbers from the country in which we offer our services: in France. The peculiarity is that the telephone numbers should be all made up of exactly 10 digits.

our landing page :

I found a few scripts that might have worked, but ultimately none worked. We are not able to develop javascript ourselves and request your help to obtain this code which would require the telephone numbers to be:

  • only composed of numbers.
  • be made up of exactly 10 digits!




Here is an example page that checks for a French phone number.

This is the script. Make sure you change phone_number to whatever is your field ID.

  window.ub.form.validationRules.phone_number.FrenchCustomRule = true;
  window.ub.form.customValidators.FrenchCustomRule = {
    isValid: function(value) {
      return /^(?:(?:\+|00)33[\s.-]{0,3}(?:\(0\)[\s.-]{0,3})?|0)[1-9](?:(?:[\s.-]?\d{2}){4}|\d{2}(?:[\s.-]?\d{3}){2})$/.test(value);

    message: 'Please enter a valid French phone number',

Last but not least, the RegEx is not mine so feel free to adjust it as need it. This is the StackOverflow post that gives examples of regexes for French phone numbers.

The regex I used for the script above, what it checks for and what it accepts as a valid French number.