how do I make the Phone Number mandatory on the Contact Us form in Magento 2.3?

I was expecting it to be an option in the Admin section but I cannot find it.

1 Answer 1


You need to extend the template file in you app/design.

Path :app/design/frontend/vendor/theme/Magento_Contact/templates/form.phtml

add below code on the place of phone number field.

<div class="field telephone required">
            <label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label>
            <div class="control">
                <input name="telephone" id="telephone" title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>" value="<?= $block->escapeHtmlAttr($this->helper(\Magento\Contact\Helper\Data::class)->getPostValue('telephone')) ?>" class="input-text" type="text" data-validate="{required:true, 'validate-email':true}" aria-required="true"/>

enter image description here

  • Hi - thanks for the prompt response. This line is telling me that it is trying to validate an email address and not a telephone number - data-validate="{required:true, 'validate-email':true}" Jan 13, 2020 at 14:32
  • Yes , you can change that validation type to number Jan 13, 2020 at 14:52

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.