We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6902
    • 126 Posts
    I have checked and rechecked all of my fields, snippet calls, etc., but I’m stumped here. I’m beginning to wonder if its my client’s iffy web host...

    This is just a super-simple contact form. All of the fields validate properly. A successful submission redirects to the proper page and sends out the email just fine. Failed validation bounces back to the form as it should with all the fields repopulated... but no error messages are returned.

    I’m hoping someone sees a typo or something stupid that I missed... I’m off to uninstall and reinstall Formit (I’ve had issues with this server before).

    Here’s my code:

    [[!FormIt?  
       &hooks=`spam,email,redirect`
       &emailTpl=`contact-email-tpl`
       &emailTo=`[email protected]`
       &emailSubject=`[Web Contact Form]`
       &emailFrom=`[[+email]]`
       &emailFromName=`[[+name]]`
       &emailReplyTo=`[[+email]]`
       &emailReplyToName=`[[+name]]`
       &redirectTo=`15`
       &validate=`workemail:blank,name:required,email:email:required,text:required:stripTags`
    ]]
    
    <h1>Contact Us</h1>  
    
    [[!+fi.error.error_message:notempty=`<div id="errorMsg"><h3>Whoops!</h3><ul><li>[[!+fi.error.error_message]]</li></ul></div>`]]  
    
    <form action="[[~[[*id]]]]" method="post" class="uniForm">  
      <input type="hidden" name="workemail" value="" />  
    
      <fieldset class="inlineLabels">
    
        <div class="ctrlHolder [[+fi.error.name:notempty=`error`]]">
          <label for="name"><em>*</em> Full Name</label>
          <input type="text" id="name" name="name" value="[[+fi.name]]" size="35" class="textInput [[+fi.error.name:notempty=`error`]]">
          [[+fi.error.name:notempty=`<p class="formHint">[[+fi.error.name]]</p>`]]
        </div>
      
        <div class="ctrlHolder [[+fi.error.email:notempty=`error`]]">
          <label for="email"><em>*</em> Email Address</label>
          <input type="text" id="email" name="email" value="[[+fi.email]]" size="35" class="textInput [[+fi.error.email:notempty=`error`]]">
          [[+fi.error.email:notempty=`<p class="formHint">[[+fi.error.email]]</p>`]]
        </div>
        
        <div class="ctrlHolder">
          <label for="phone">Phone Number</label>
          <input type="text" id="phone" name="phone" value="[[+fi.phone]]" size="35" class="textInput">
        </div>
      
        <div class="ctrlHolder [[+fi.error.text:notempty=`error`]]">
          <label for="text"><em>*</em> Message</label>
          <textarea id="text" name="text" rows="25" cols="25" class="[[+fi.error.text:notempty=`error`]]" value="[[+fi.text]]">[[+fi.text]]</textarea>
          [[+fi.error.text:notempty=`<p class="formHint">[[+fi.error.text]]</p>`]]
        </div>
        <div class="buttonHolder"><button type="submit" class="primaryAction">Send</button></div>
      </fieldset>
    </form>
      • 6902
      • 126 Posts
      Uninstall and reinstall of Formit didn’t change anything...

      BTW: Running Revo 2.0.6-pl, and Formit 1.5.3 rc2
        • 22019
        • 390 Posts
        Assuming the class isn’t hidden, have you tried removing the notempty output filters and seeing what happens? I often have trouble getting that filter to work properly.
          Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
          • 28215
          • 4,149 Posts
          You *really* should be using the ! uncached symbol when using output filters - otherwise, you’re caching the result of the filter for every single occurrence thereafter. So:

          [[+fi.error.name:notempty=`error`]]

          Should be:
          [[!+fi.error.name:notempty=`error`]]


          This also includes:

          [[+fi.error.text:notempty=`<p class="formHint">[[+fi.error.text]]</p>`]]

          should be:
          [[!+fi.error.text:notempty=`<p class="formHint">[[+fi.error.text]]</p>`]]


          Anytime you use a filter like that, make sure the placeholder is uncached.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 6902
            • 126 Posts
            For some reason my earlier reply didn’t go through... I switched them all to uncached and it works fine (except for the fi.error.error_message placeholder--which I can live with).
              • 19388
              • 297 Posts
              I know this is an old post but error_message does not display for me too:
              [[!+fi.error.error_message:notempty=`<p class="error">[[!+fi.error.error_message]]</p>`]]


              This works good:
              <span class="[[!+fi.error.nombre:notempty=`error`]]">


                • 28215
                • 4,149 Posts
                Quote from: mIDO at Feb 11, 2011, 12:20 PM

                I know this is an old post but error_message does not display for me too:
                [[!+fi.error.error_message:notempty=`<p class="error">[[!+fi.error.error_message]]</p>`]]


                Do:
                ][[!+fi.error_message]]
                  shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                  • 19388
                  • 297 Posts
                  I’ve tried:
                  [[!+fi.error_message:notempty=`<p class="error">[[!+fi.error_message]]</p>`]]


                  and

                  [[!+fi.error_message]]
                  [[!+fi.error_message:notempty=`<p class="error">[[!+fi.error_message]]</p>`]]


                  No error appears.

                  This is working:
                  <p>
                                    <label for="empresa"><span class="[[!+fi.error.empresa:notempty=`error`]]">Empresa *</span></label>
                                    <input name="empresa" id="empresa" value="[[+fi.empresa]]" type="text" />
                                  </p>


                  But not the generic error message.

                  Thanks Shaun!
                    • 22019
                    • 390 Posts
                    Looks like you’re mixing things up.

                    The specific error message is [[!+fi.error.empresa]].

                    Because the error message itself is not empty, it triggers the output filter to output ’error’. If you just left it at [[!+fi.error.empresa]] - with no output filter - it should output the generic message triggered by the validation for that field.
                      Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                      • 19388
                      • 297 Posts
                      Yes, the specific error is working fine. When it is not empty ( there is an error ) , it adds the corresponding class to show the label in red&bold.
                      But the generic error message is not appearing.
                      I finally solved it using a custom validator.