Accept specific phone format in Gravity Forms
You can force rules on field Phone Number in Gravity Forms.
Simply add this code to your plugin or function file, then select in your field which format you want to accept (in this example you can accept French and Swiss phone numbers):
<?php add_filter( 'gform_phone_formats', 'additional_phone_format' ); function additional_phone_format( $phone_formats ) { $phone_formats = array( 'standard' => array( 'label' => '(###) ###-####', 'mask' => '(999) 999-9999', 'regex' => '/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/', 'instruction' => '(###) ###-####', ), 'international' => array( 'label' => __( 'International', 'gravityforms' ), 'mask' => false, 'regex' => false, 'instruction' => false, ), 'FR' => array( 'label' => 'France', 'mask' => '99 99 99 99 99', 'regex' => '/^(?:(?:\+|00)33[\s.-]{0,3}(?:\(0\)[\s.-]{0,3})?|0)[1-9](?:(?:[\s.-]?\d{2}){4}|\d{2}(?:[\s.-]?\d{3}){2})$/', 'instruction' => '## ## ## ## ##', ), 'CH' => array( 'label' => 'Suisse', 'mask' => '999 999 99 99', 'regex' => '/^(021|022|024|026|027|031|032|033|034|041|043|044|052|055|056|061|062|071|075|076|077|078|079|081|091)\s(\d{3})\s(\d{2})\s(\d{2})$/', 'instruction' => '### ### ## ##', ), ); return $phone_formats; } ?>
If you want to use multiple country format in Gravity Forms, you have to consider Gravity Wiz.