How to validate phone number for billing address (should accept only number's and it should not exceed more then 10 digits) in magento2.1.7?

3 Answers 3


For billing address validation in magento 2.1.7, just check out the file path in


'telephone' => [
                            'validation' => [
                    //'mobileInD' => true,
                    'validate-number' => 0,
                    'min_text_length' => 10,   
                    'max_text_length' => 10,
                                'config' => [
                                    'tooltip' => [
                                        'description' => __('For delivery questions.'),

You can try following code :

<input type="text" name="billing[telephone]" value="" title="Telephone" 
class="input-text  required-entry validate-length maximum-length-10 minimum- 
length-10 validate-digits" id="billing:telephone" placeholder="Mobile">

Hope this helps!

  • Thanks Prasad, but i already got the answer.
    – Amy
    Commented Nov 13, 2018 at 6:12

You can apply the below validations according to your choice:

<validate>validate-length maximum-length-10</validate>



For example if you are applying validation form system configuration file then it should be like this:

<field id="number" translate="label" type="text" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>Customer Service</label>
                <comment>Please enter an internationalized version of the phone number. For example +91 XXX XXXXXXX</comment>
                <validate>validate-phoneStrict validate-length maximum-length-10</validate>


See more validations here

  • Thanks Ajwad, but i already got the answer.
    – Amy
    Commented Nov 13, 2018 at 6:11
  • Great, May be helpful for next searchers.
    – Ajwad Syed
    Commented Nov 13, 2018 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.