We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34018 ☆ A M B ☆
    • 100 Posts
    When I add a field on a contact form for the Telephone of the visitor, the form doesn’t work, it validates but does not set, removing the field it works normally.

    <form action="[[~[[*id]]]]" method="post" class="form"><fieldset>
        <input type="hidden" name="nospam:blank" value="" />
    <p>
        <label for="name">
            Nome:
            
        </label>
        <input type="text" name="name:required" id="name" value="[[+fi.name]]" />
        <span class="error">[[+fi.error.name]]</span></p>
    
    <p>    <label for="email">
            E-mail:
            
        </label>
        <input type="text" name="email:email:required" id="email" value="[[+fi.email]]" />
        <span class="error">[[+fi.error.email]]</span>
    </p>
    <p>
        <label for="telefone">
            Telefone:
            
        </label>
        <input type="text" name="telefone:required:isNumber" id="telefone" value="[[+fi.telefone]]" />
        <span class="error">[[+fi.error.telefone]]</span></p>
    <p>
        <label for="subject">
            Assunto:
           
        </label>
        <input type="text" name="subject:required" id="subject" value="[[+fi.subject]]" />
         <span class="error">[[+fi.error.subject]]</span>
    </p><p>
        <label for="text">
            Mensagem:
            
        </label>
        <textarea name="text:required:stripTags" id="text" cols="55" rows="7" value="[[+fi.text]]">[[+fi.text]]</textarea>
        <span class="error">[[+fi.error.text]]</span></p>
    
    
            <input type="submit" value="Send Contact Inquiry" /></fieldset>
    </form>


    Is there something I did wrong?
      ----
      Daniel Melo
      • 34018 ☆ A M B ☆
      • 100 Posts
      I tested I saw that if I turn the isNumber validation OFF the form works, is there any bugs with the isNumber validation?

      Another problem that I saw is that I can’t validate a not required field, is there anyway?
        ----
        Daniel Melo
        • 1778
        • 659 Posts
        You can write your own validators for the fields you want to be validated, the field has not to be required for this...