We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28099
    • 39 Posts
    I have a bizarre issue. Formit is not processing at all. In fact, the form is behaving as if there was no Formit package installed. I removed formit just to verify this behavior. It simply reloads the current page.

    I also removed the hooks one by one in case one of them was failing. No difference.

    It's as if ModX is not even loading or talking to the FormIt snippet.

    I also tried moving the form to another page just for testing sake.

    I even re-ran setup for ModX.

    The other part that makes this weird is that I am using the exact same form code (pretty much exactly the same as the example) that I put in every new site I build. This is the first time this has happened.

    Snippet:
    [[!FormIt?
       &hooks=`spam,email,redirect`
       &emailTpl=`MyEmailChunk`
       &emailTo=`[email protected]`
       &redirectTo=`7`
       &emailSubject=`Contact Form submission from website`
       &validate=`name:required,
          email:email:required,
          text:required:stripTags`
    ]]
    


    Form:
    [[!+fi.error.error_message:notempty=`<p>[[!+fi.error.error_message]]</p>`]]
     
    <form action="[[~[[*id]]]]" method="post" class="form" id="contactForm">
        <input type="hidden" name="nospam:blank" value="" />
     
        <label for="name">
            Name:
            <span class="error">[[!+fi.error.name]]</span>
        </label><br />
        <input type="text" name="name" id="name" value="[[!+fi.name]]" />
     
        <label for="email">
            Email:
            <span class="error">[[!+fi.error.email]]</span>
        </label><br />
        <input type="text" name="email" id="email" value="[[!+fi.email]]" />
     
        <label for="phone">
            Phone:
            <span class="error">[[!+fi.error.phone]]</span>
        </label><br />
        <input type="text" name="phone" id="phone" value="[[!+fi.phone]]" />
     
     
        <label for="text">
            Message:
            <span class="error">[[!+fi.error.text]]</span>
        </label><br />
        <textarea name="text" id="text" cols="55" rows="7">[[!+fi.text]]</textarea>
     
     
        <br class="clear" />
        [[!+formit.recaptcha_html]]
        [[!+fi.error.recaptcha]]
     
    
     
        <div class="form-buttons">
            <input type="submit" name="submit" id="submit-button" value="Send" /> 
        </div>
    </form>
    
    Anyone else experience this? 
    

      • 32316
      • 387 Posts
      Unless I'm missing something I think you misunderstand how to setup a page using FormIt.
      If that is the case this may help:

      The code you have after "Snippet:" is a call to the FormIt snippet and belongs in the resource that has your form html code or possibly in a chunk that you include the resource. Just take the call that starts [[!FormIt and paste it above your form html.

      Snippets are php code.
      [[ blah... ]] are 'modx tags' that are processed by modx
      and belong in html code - either in a template, a resource or a chunk.
        • 28099
        • 39 Posts
        Sorry, my bad. I meant snippet call. I don't do any customization on the actual snippets.
          • 32316
          • 387 Posts
          I kind of thought that I was not understanding what you were doing.

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

          while the example code (which I have used with success) is:
          [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]

          However I don't believe this is causing your problem.
          I don't see any other problems - doesn't mean there aren't any!

          You do not mention versions of modx, format etc you are using - might help
            • 28099
            • 39 Posts
            As an update to this post....

            Turns out all code was fine. I thought that had to be the case since it is the same code I use on all sites.

            There is some weird conflict going on with something else. The snippet call is conflicting with something that I have not quite found yet. But I do have the issue narrowed down to the snippet call and something in my main template file.

            I thought it was conflicting with the IF snippet I was using to determine what chunks to serve in the template. But I dropped the If references and used output modifiers instead.

            That didn't change anything so I am still trying to narrow down where the conflict is.
              • 16313
              • 71 Posts
              I guess an issue in placeholder, inside output filter.
              here is example.
              this code is working because it contains only string:
              [[!+fi.successMessage:empty=`qwerty`]]

              this code works, when placeholder [[+fi.error.subdomain]] is not empty:
              [[!+fi.successMessage:empty=`qwerty[[+fi.error.subdomain]]`]]


              My configuration is: MODx 2.1.3, LAMP php 5.3.2, mysql 5.1.41
              but on another servers I have same issue.
              it maybe a bug or trouble in modx configuration.
              can somebody help us?
                • 3749
                • 24,544 Posts
                Try this (placeholder uncached):

                empty=`qwerty[[!+fi.error.subdomain]]`

                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 16313
                  • 71 Posts
                  I tried, but no luck with uncached placeholder.
                  when I used uncached placeholder, I saw text with placeholder value only when placeholder is not empty.
                  with cached placeholder I don't see anything.
                  here is a samle:
                  http://revodemo.krava.in.ua/formit.html
                  try to submit empty form.
                  this is a chunk code:
                  [[!FormIt? 
                      &emailTpl=`EmailChunk` 
                      &successMessage=`<div class="thank-you">Thank you for your message</div>`
                      &emailTo=`[[++emailsender]]` 
                      &emailSubject=`New contact message` 
                      &validate=`name:required`
                  ]] 
                  
                   
                  [[!+fi.error_message:notempty=`<div class="error">[[!+fi.error_message]]</div>`]] 
                  
                  1. Only text: [[!+fi.successMessage:empty=`qwerty`]]
                  
                  2. Cached: [[!+fi.successMessage:empty=`qwerty[[+fi.error.name]]`]]
                  
                  3. Uncached: [[!+fi.successMessage:empty=`qwerty[[!+fi.error.name]]`]]
                  
                  
                  
                  <form class="form" action="[[~[[*id]]]]" method="post" name="form">
                      <input type="hidden" name="nospam:blank" value="" />
                    
                    <label>Name*<span class="error">[[!+fi.error.name]]</span></label>
                    <input id="name" name="name" type="text" value="[[!+fi.name]]" />
                    
                    <input class="submit" name="form" type="submit" value="Submit" />
                  </form>

                  Maybe it will help better in solving the issue. Bob, also I can give credentials for the test site.
                  by the way, placeholder error_message does not show errors too. [ed. note: krava last edited this post 12 years, 7 months ago.]
                    • 3749
                    • 24,544 Posts
                    Maybe I'm confused, but it seems to be working.

                    I see this when submitting an empty form:

                    1. Only text: qwerty
                    2. Cached:
                    3. Uncached: qwerty This field is required.

                    Name* This field is required. ____________
                    and a just the "thank you" message when I fill it in. [ed. note: BobRay last edited this post 12 years, 6 months ago.]
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 16313
                      • 71 Posts
                      But i don't see "qwerty" in 2th and 3th items, when the page just loaded.
                      1. Only text: qwerty
                      2. Cached:
                      3. Uncached: 

                      why do I need?
                      if I insert form into successMessage placeholder, I don't see it too(as a "qwerty").
                      Actually I'd like to add form into successMessage placeholder, and it should appear when page just loaded, and disappear when message sent. but I don't see a form too, as a "qwerty" word.