We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30223
    • 1,010 Posts
    The duplicate submit protection happens after the eFormOnBeforeMailSent event. Instead use the eFormOnMailSent event and you’ll have the behaviour that you want. The event is a bit of misnomer, it get’s "fired" regardless if you sent mail or not.
      • 24278
      • 165 Posts
      ...use the eFormOnMailSent event and you’ll have the behaviour that you want. The event is a bit of misnomer, it get’s "fired" regardless if you sent mail or not.

      You guys and modx never cease to amaze me... smiley it works as expected. Thanks a bunch.
      • Quote from: TobyL at Apr 20, 2007, 03:09 PM

        The duplicate submit protection happens after the eFormOnBeforeMailSent event. Instead use the eFormOnMailSent event and you’ll have the behaviour that you want. The event is a bit of misnomer, it get’s "fired" regardless if you sent mail or not.

        @TobyL,

        Toby, when trying to use eFormOnMailSent & noemail params, my function never seem to get ran (No db insert). As I am using eForm solely for DB capture, and not emailing, is there a eForm* function you recommend that:

        1. Prevents duplication on refresh
        1a. Works with &noemail param
        2. Runs AFTER validation has been confirmed

        ???

        When I change back to eFormOnBeforeMailSent, it works. (using eForm 1.4.4)
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.
          • 30223
          • 1,010 Posts
          QQPs,... Quite right, I was so wrong about that embarrassed apologies. The eFormOnMailSent event only happens if mail is being sent after all.

          There is no other event unfortunately.. The best and easiest solution is to move the eFormOnMailSent event out of the "no-mail" code block. You can try to move the closing bracket on line 534 to line 515. Reviewing this code it looks like it needs a bit of a cleanup anyway.

          Try it out and let me know if you run into any issues. I haven’t tested it but this should not impact an anything else.

          <?php
                   }//end test nomail <---- MOVE TO HERE
                   
                    # added in 1.4.2 - Protection against multiple submit with same form data
                    if($protectSubmit) $_SESSION[$formid.'_hash'] = $hash; //hash is set earlier
          
                    # added in 1.4.2 - Limit the time between form submissions
                    if($submitLimit>0) $_SESSION[$formid.'_limit'] = time();
          
          /*
          * mod - by JJ removed reference from function call as it's deprecated in current PHP
          * Remember to treat parameter as a reference in function!!
          */
                      # invoke OnMailSent event set by another script
                      if ($eFormOnMailSent) {
                         if( $isDebug && !function_exists($eFormOnMailSent) )
                            $fields['debug'] .= "eFormOnMailSent event: Could not find the function" . $eFormOnMailSent;
                         else
                            if ($eFormOnMailSent($fields)===false) return;
                      }
          
          //       }//end test nomail <---- MOVE FROM HERE
          
          ?>
          
            • 10647
            • 36 Posts
            Hi, I don’t understand where I can set the table to store the information to. Is it in the snippet or somewhere else? Thanks.
            • Quote from: General_Sun at May 12, 2007, 01:25 PM

              Hi, I don’t understand where I can set the table to store the information to. Is it in the snippet or somewhere else? Thanks.



              // Run the db insert query
              $dbQuery = $modx->db->insert( $dbTable, $table_prefix . ’insertTableName’ );

              above is an excerpt from the example post on Page 1...

              please replace insertTableName with YourTableName
                Mike Reid - www.pixelchutes.com
                MODx Ambassador / Contributor
                [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                ________________________________
                Where every pixel matters.
                • 10647
                • 36 Posts
                Does this mean I can only have one form per installation? huh Is there a way to insert values for different forms into different tables? Thanks.
                • Quote from: General_Sun at May 12, 2007, 05:31 PM

                  Does this mean I can only have one form per installation? huh Is there a way to insert values for different forms into different tables? Thanks.

                  please read up on the eForm documntation in the forums and from the eForm download. Upon familiarizing yourself with eForm, I think that you’ll hopefully better understand the concept behind eForm2db’s functionality.

                  In short, you can have as many forms as you want and put data into as many tables as you want, you just have to customize the example from page 1 to fit your circumstances.

                  I also suggest reading up on the DBAPI class in the MODx documntation or wiki. Then you’ll be set. smiley
                    Mike Reid - www.pixelchutes.com
                    MODx Ambassador / Contributor
                    [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                    ________________________________
                    Where every pixel matters.
                    • 14796
                    • 59 Posts
                    Hey I didn’t see anything in the posts for using this with a database outside of modx.

                    I tried to manipulate it so that it would work, but after I click submit, I get a blank page.

                    The eform works fine by itself and I can upload information to the database manually through the calls.

                    Once I try to connect the 2 using this, that’s when it messes up.

                    If anyone could help me get on track I’d be very thankful.

                    Thanks,

                    Josh
                      • 30223
                      • 1,010 Posts
                      Without some more information and some code it’s rather difficult to guess what you’re up to....