Home › Forums › Feature Requests › Phone Number Field › Reply To: Phone Number Field
@hube2 There are some libraries to easily valid a phone number : https://github.com/giggsey/libphonenumber-for-php
But you’re right : outside US, the phone parts don’t make sense. Even in US, the parts work for a cell number ?
@webendev Apparently Gravity Forms valid only US format. The International option valids… nothing
Code snippet from the plugin :
$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,
),
);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.