All Collections
Frequently Asked Questions – FAQ
Require Telephone in the Contact Us Form
Require Telephone in the Contact Us Form

You can use this simple trick to make the phone field a required input in the contact us form.

Séamus Diamond avatar
Written by Séamus Diamond
Updated over a week ago

If you want to force users to enter a telephone number in your contact us form here is a simple way to enable that.

  1. Login to your admin and navigate to Appearance→Theme Options→Footer Block (within the options tab)

  2. Note: If there is any content in your Footer Block be sure to leave it as is and add this to the bottom of that content (you don't want to loose what's already in there).  Add the following javascript to the Footer Block and publish:

/* makes the phone field a required input in the contact us form */
<script>
$(document).ready(function () {
    if ($('body').hasClass('ex-name-contactus')) {
        // Get the tel input
        var telInput = $("input[name=telephone]");
        // Make it required
        telInput.attr('required', true);
        // Change label to Phone (removes - optional)
        telInput.closest('.form-group').find('label').html('Phone');
    }
});
</script>

Test your change and make sure everything looks fine.

Did this answer your question?