Making fields on the minimal theme contact form mandatory

Hi Guys,

Hope someone can help me.

How can I make my contact form fields required on my contact page. I have the minimal theme.


  

    

      # {{ page.title }}
    

    
      {{ page.content }}
    

    
      
      {% form 'contact' %}

        {% if form.posted_successfully? %}
          

            {{ 'contact.form.post_success' | t }}
          

        {% endif %}

        {{ form.errors | default_errors }}

        {% assign name_attr = 'contact.form.name' | t | handle %}
        
        

        
        

        {% assign name_attr = 'contact.form.phone' | t | handle %}
        
        

        
        

        

      {% endform %}
      
   

 

Thanks in advance.

The quickest and easiest way would be to add a ‘required’ attribute to those inputs.


The browser will stop the submission of the form and show an error if the required field is not filled out.

Thanks for that.

Very easy, and did the job.