Some snippets to put in your functions.php and adapt if needed for language to trigger :
Mobile number
/* $phone_formats['fr'] = array(
'label' => 'Belgium mobile',
'mask' => '9999/999999',
'regex' => '/?([0-9]{4})\/?([ .-]?)([0-9]{3})\2([0-9]{4})/',
'instruction' => __('Insert only digits from your mobile number', 'client_theme'),
);
Phone number
$phone_formats['fr'] = array
'label' => 'Belgium phone',
'mask' => '999/999999',
'regex' => '/?([0-9]{3})\/?([ .-]?)([0-9]{3})\2([0-9]{4})/',
'instruction' => __('nsert only digits from your phone number', 'client_theme'),
);
Unified mobile and phone number
$phone_formats['fr'] = array(
'label' => 'Unified Belgium mobile and phone',
'mask' => '999999999?9',
'regex' => '/^0\d{9,10}$/', // phone at least 9 numbers
'instruction' => __('Inserts only digits', 'client_theme'),
);
Official Gravity forms documentation
More informations with maks and regex for phone numbers in Gravity forms documentation
Be First to Comment