We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37059
    • 368 Posts
    On my contact form, FormIt is working to send email, but it doesn't return validation messages or redirect on success. When you submit an invalid form, the form goes blank and no email is sent. If you submit a valid form, the email is sent but the form once again goes blank - and doesn't redirect.

    MODx 2.0.2-pl2, FormIt 2.0.3.

    My complete FormIt call and contact form are below. Any help would be greatly appreciated.

    [[!Formit?
    &hooks=`spam,email,redirect`
    &emailTo=`[email protected]`
    &emailSubject=`Contact from "[[+name]]"`
    &emailTpl=`contactEmailTpl`
    &redirectTo=`14`
    &validate=`
      nospam:blank,
      email:required:email,
      name:required,
      message:required:stripTags
    `
    &email.vTextEmailInvalid=`Email address invalid.`
    &message.vTextRequired=`Please type a message.`
    ]]
    
    
    
    <form class="email validate" action="[[~[[*id]]]]" method="post">
    
    
    <input type="hidden" name="nospam" value="[[+fi.nospam]]">
    
    
    <label class="name"><span class="hide">Name*</span>
    <input type="text" name="name"  value="[[+fi.name]]" placeholder="name (required)">
    [[+fi.error.name]]
    </label>
    
    <label class="email"><span class="hide">Email*</span>
    <input type="text" name="email" value="[[+fi.email]]" placeholder="email (required)">
    [[+fi.error.email]]
    </label>
    
    <label class="phone"><span class="hide">Phone</span>
    <input type="text" name="phone" value="[[+fi.phone]]" placeholder="phone">
    [[+fi.error.phone]]
    </label>
    
    <label class="city"><span class="hide">City</span>
    <input type="text" name="city" value="[[+fi.city]]" placeholder="city">
    [[+fi.error.city]]
    </label>
    
    <label class="state"><span class="hide">State</span>
    <select name="state">
    <option value="">State</option>
    [[!FormItStateOptions? &selected=`[[!+fi.state]]`]]
    </select>
    </label>
    
    
    
    <label class="message"><span class="hide">Message</span>
    <textarea name="message" placeholder="Please type your message here">[[+fi.message]]</textarea>
    [[+fi.error.message]]
    </label>
    
    
    
    <input class="submit" type="submit" value="Send Email >">
    
    </form>
    
      Jason
      • 37059
      • 368 Posts
      Turns out this was a Javascript issue - an HTML5 form validation library I was using somehow killed the form, even though I wasn't using HTML5 validation attributes in that version of the form.

      Anyway, it's not a Formit problem.
        Jason