We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7045
    • 225 Posts
    Ok, that knocked a little sense into me, and I am starting to understand a little better. I removed all the hooks from the contact form (just to test), hit the "login" button, and I got no email (I just got the login error tpl I created). That is good, and now I need a hidden form field to detect a repost I assume, or maybe a hook?
      • 3749
      • 24,544 Posts
      I don’t think so. Try putting everything back the way it was and adding &submitVar=`submitVar` to your FormIt tag.

      That should fix the Login email problem.

      Then you need to add this to your FormIt form to make FormIt work:

      <input type="hidden" value="submitVar" name="submitVar" />
        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
        • 7045
        • 225 Posts
        Bob, you are a saint and a genius. I did as you said and everything is working perfectly. I am not going to pretend that I completely understand what that did, but I will tackle learning that in the AM. For now, I need to make sure I put everything completely back together.

        Thanks so much Bob.
          • 3749
          • 24,544 Posts
          I’m glad it worked. smiley

          The key to understanding it is that any snippet that processes a form will execute when the page is first loaded, then execute again when "Submit" is clicked to process the form. Obviously, it needs to behave differently in each case. The first time, it just displays the form. The second time it processes it.

          All the variables in the form are set in the $_POST array, but only when the form is actually submitted.

          The trick is accomplished by putting a hidden variable in the form that will only be set when it is submitted. The test in the FormIt snippet that I posted above performs the test. It returns an empty string if the $_POST variable is not set and the &submitVar property in the snippet tag *is* set.

          The first time through, the property is set, but the $_POST variable isn’t, so it returns an empty string (no output from the snippet). The form is on the page itself, so it displays. The second time through, the property is set and so is the $_POST variable so the snippet code executes and sends the email.

          When the property is not set, FormIt will try to process the form and send an email when the page is posted. The test should probably check the value of the $_POST variable against the parameter.
            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
            • 7045
            • 225 Posts
            Thanks for all the help and the explanation Bob. I now understand everything that is going on with your solution. I also took another look at the documentation for formit. And of course, it talks about all this in black and white. Sorry for wasting your time, but you have helped me understand it all.
            • Similar to my current challenge