We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8425
    • 159 Posts
    Hello,
    I'm using MODX 1.05 with the snippet eForm and the parameter eFormOnBeforeMailSent to invoke a function to update a database table.
    Everything works fine but if the user clicks back on the browser and re-submit the form, I get a message that the form was already submitted but the function associated with the event eFormOnBeforeMailSent is invoked one more time creating duplicate data in the database.
    Is there a way to prevent the function to be re-run once the eForm has already be submitted?

    Thanks for your help and time
      • 36416
      • 589 Posts
      Quote from: eclipseTalk at Dec 18, 2012, 10:20 AM
      Is there a way to prevent the function to be re-run once the eForm has already be submitted?

      If you're really really sure that form was submitted the first time, you can check
      documentation for the following parameters:
      &protectSubmit
      &submitLimit
        • 8425
        • 159 Posts
        Thanks for your reply. The &protectSubmit parameter by default is set to 1. The form display a message when it was already submitted but the function associated with the paramter eFormOnBeforeMailSent is always re-run...
          • 36416
          • 589 Posts
          Quote from: eclipseTalk at Dec 18, 2012, 02:09 PM
          The &protectSubmit parameter by default is set to 1. The form display a message when it was already submitted but the function associated with the paramter eFormOnBeforeMailSent is always re-run...

          I tried above scenario with protectSubmit=`1`&submitLimit=`5` in Chrome 23, and eForm
          blocked the second submission. Check if the right parameter name points to your
          beforeMailSent function. Are cookies enabled in the browser?
            • 8425
            • 159 Posts
            Thanks using both protectSubmit and submitLimit works fine. I was only using protectSubmit.