We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23510
    • 168 Posts
    Here is my formit code. No matter what I do, I cannot get the validation errors to display. I have tried combinations of Formit snippet uncached and cached. the chunk it is inside, cached and uncached, etc. This is terribly frustrating!

    Note that the form submits just fine once all the fields are entered - just that if I submit a blank form, I do not see anything.

    
        [[!FormIt? 
          &hooks=`spam,addresstohook,email,FormItSaveForm,FormItAutoResponder,crmhook`
          &emailTo=`[[+addressTo]]`
          &emailSubject=`GET A TOUR FORM: [[+first_name]] [[+last_name]]`
          &emailFromName=`COWORK|RS`
          &emailTpl=`email`
          &validate=`
    first_name:required,
    e_mail:email:required,
    interestedin:required,
    last_name:required,
    company_name:required,
    phone:required`
          &validationErrorMessage=`<div class="err_message">Please make sure<br/>All required fields are<br/>filled out correctly</div><div class="err_button"><span>OK</span></div>`
          &successMessage=`<div class="success_head">Thank you</div><div class="success_mesage">for your message<br/>we will contact you soon</div>`
          &errTpl=`<div class="err_message">[[+error]]</div>`
          &fiarTpl=`email-autoresponse`
          &fiarSubject=`Thank you for contacting COWORK|RS!`
          &fiarToField=`e_mail`
          &fiarFrom=`[email protected]`
          &fiarFromName=`COWORK|RS`
          &submitVar=`gettourform-submit`
          &store=`1`
    
        ]]
    
        
    
          <div class="form">
            <div class="formwrapper showall">
    
    [[!+fi.validationErrorMessage:notempty=`<div class="err_message">[[!+fi.validationErrorMessage]] | [[!+fi.errors]]</div>`]]
    
    [[!+fi.successMessage]]
    
              <form action="/tour" method="post" >
                [[!+fi.addressTo]]
                <input type="hidden" value="Flatiron" name="location" />
                <input type="hidden" value="Coworking" name="interestedin" />
                <h3 class="loc">Location</h3>
                <div class="opt-flatiron active"><div class="label">Flatiron</div><div class="option"></div></div>
                <div class="opt-gowanus"><div class="label">Gowanus</div><div class="option"></div></div>
                <div class="opt-fidi"><div class="label">FiDi</div><div class="label fulltitle">Financial District</div><div class="option"></div></div>
                <h3 class="det">Your details</h3>
    
                <div class="firstname">
                  <label for="first_name">First name</label>
                  <input type="text" name="first_name" id="first_name" value="[[!+fi.first_name]]"/></div>
    
                <div class="lastname">
                  <label for="last_name">Last name</label>
                  <input type="text" name="last_name" id="last_name" value="[[!+fi.last_name]]"/></div>
    
                <div class="companyname">
                  <label for="company_name">Company name</label>
                  <input type="text" name="company_name" id="company_name" value="[[!+fi.company_name]]"/></div>
    
                <div class="email">
                  <label for="e_mail">Email</label>
                  <input type="text" name="e_mail" id="e_mail" value="[[!+fi.e_mail]]"/></div>
    
                <div class="phone">
                  <label for="phone">Phone number</label>
                  <input type="text" name="phone" id="phone" value="[[!+fi.phone]]"/></div>
    
                <h3 class="interestedh">Interested in</h3>
                <div class="interested">Coworking</div>
                <div class="interested-list">
                  <div class="option" data-value="Coworking">Coworking</div>
                  <div class="option" data-value="Dedicated Coworking">Dedicated Coworking</div>
                  <div class="option" data-value="1 person">1 person</div>
                  <div class="option" data-value="2 people">2 people</div>
                  <div class="option" data-value="3 people">3 people</div>
                  <div class="option" data-value="4 people">4 people</div>
                  <div class="option" data-value="5 people">5 people</div>
                  <div class="option" data-value="6 people">6 people</div>
                  <div class="option" data-value="7 people">7 people</div>
                  <div class="option" data-value="8 people">8 people</div>
                  <div class="option" data-value="8+ people">8+ people</div>
                  <div class="option" data-value="Meeting Room Only">Meeting Room Only</div>
                  <div class="option" data-value="Event Space">Event Space</div>
                  
                </div>
                <input type="submit" class="submit" value="Request tour" name="gettourform-submit" />
              </form>
              <!-- <div class="formmsg-ajax_form"></div> -->
            </div>
          </div>
    
      • 23510
      • 168 Posts
      Quote from: pixelstation at Sep 08, 2015, 12:03 PM
      Here is my formit code. No matter what I do, I cannot get the validation errors to display. I have tried combinations of Formit snippet uncached and cached. the chunk it is inside, cached and uncached, etc. This is terribly frustrating!

      Note that the form submits just fine once all the fields are entered - just that if I submit a blank form, I do not see anything.


      Also on submitting the form successfully, I just get a blank form. I do not see a success message.
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        When you say blank page, do you mean blank as in a completely white page, not even the rest of your page/template? If so, that sounds like you might be getting a fatal PHP error somewhere. Checking your PHP error log, or enabling errors to show on the page might help track that down.

        Might be worth removing all items from the hooks property to see if that has anything to do with it.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 23510
          • 168 Posts
          No, sorry, not a blank page...just that the errors do not get displayed. The form alone is displayed. [ed. note: pixelstation last edited this post 11 years, 1 month ago.]
            • 48532
            • 23 Posts
            Try:
            [[!+fi.validation_error_message]]

            to display the error message instead of [[!+fi.validationErrorMessage]].

            This will contain a validation error message, which can be set using the &validationErrorMessage property, and using [[+errors]] in the property value, which will be replaced by all the field errors.

            https://rtfm.modx.com/extras/revo/formit/formit.validators

            If you have not defined otherwise, the errors can also be accessed via [[+fi.error.fieldname]],
            e.g.
            <label for="email">E-Mail:
            <span class="error">[[!+fi.error.email]]</span>
            </label>
            <input type="email" name="email" id="email" value="[[!+fi.email]]" />


              • 23510
              • 168 Posts
              I actually had fi.validation_error_message before...but I did not realise that there was a font: 0px/0px line in the base.css file so the error *was* initially being output but it was not visible. Ah the trials of working on a site that someone else worked on before.

              Thanks.