We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6561
    • 139 Posts
    So do you think this could end up in one of the next ModX versions? smiley
    • I suspect that eForm itself will indeed contain the functionality in a future release.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • Well, I don’t think that’s really necessary. As it is, it’s a great all-purpose "contact form" type application. The events make it extremely powerful on a custom-need basis. I’m afraid any more built-in functionality would just need to be hacked and modded half the time as it would not quite fit the needs of most people, while creating functions to trap the various events is endlessly customizable without touching the core eForm code.

        What is needed is more examples and tutorials and "how-to" articles on using the various events. So this is a call to anybody making functions for any eForm events to please add them to the Wiki for our edification!
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • Quote from: sottwell at Mar 23, 2007, 03:19 PM

          Well, I don’t think that’s really necessary. As it is, it’s a great all-purpose "contact form" type application. The events make it extremely powerful on a custom-need basis. I’m afraid any more built-in functionality would just need to be hacked and modded half the time as it would not quite fit the needs of most people, while creating functions to trap the various events is endlessly customizable without touching the core eForm code.

          What is needed is more examples and tutorials and "how-to" articles on using the various events. So this is a call to anybody making functions for any eForm events to please add them to the Wiki for our edification!

          Susan is completely right. Just like MODx and its System Events, eForm is very powerful and extensible because of its built in injection functions. I have used the SAME eForm core code with quite a few DIFFERENT variations of eForm system event functions, etc, all making for a completely customized experience.

          Understanding "eForm2db", as its called, is no more difficult than reading through the DBAPI documentation and understanding the submittal process of eForm.
            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
            Quote from: pixelchutes at Mar 23, 2007, 04:17 PM

            Susan is completely right. Just like MODx and its System Events, eForm is very powerful and extensible because of its built in injection functions. I have used the SAME eForm core code with quite a few DIFFERENT variations of eForm system event functions, etc, all making for a completely customized experience.

            How true! And the next major version will in fact concentrate even more on core functions and improve the ease of extendability. Some of the functionallity will in fact be removed from the core and be implemented as "default" extensions. How events (and other extensions) are called will be standardized and have access to all eForm parameters and variables.
              • 33372
              • 1,611 Posts
              It seems as if it would be really useful to include a library of functions, extensions, and regex expressions available that people can make use of with the package or in the repository somewhere.
                "Things are not what they appear to be; nor are they otherwise." - Buddha

                "Well, gee, Buddha - that wasn't very helpful..." - ZAP

                Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
              • Quote from: ZAP at Mar 24, 2007, 03:29 AM

                It seems as if it would be really useful to include a library of functions, extensions, and regex expressions available that people can make use of with the package or in the repository somewhere.

                ...and possibly make them very basic, and perhaps extendible themselves? wink Ah, plugins for eForm...NOW we’re talking!
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 24278
                  • 165 Posts
                  Great snippet. very very useful. I actually got it to work grin

                  One issue... resubmitting the form i.e. if I refresh the page... re-enters the data in the database. Whereas eForm shows a message like this "This form was already submitted succesfully. There is no need to submit your information multiple times."

                  How can we curb multiple/duplicate entries in to the database of the same form data.

                    • 26482
                    • 138 Posts
                    Quote from: Raavi at Apr 20, 2007, 12:19 PM

                    Great snippet. very very useful. I actually got it to work grin

                    Would you be able to post your working snippet code? Thanks.
                    • Quote from: Raavi at Apr 20, 2007, 12:19 PM

                      Great snippet. very very useful. I actually got it to work grin

                      One issue... resubmitting the form i.e. if I refresh the page... re-enters the data in the database. Whereas eForm shows a message like this "This form was already submitted succesfully. There is no need to submit your information multiple times."

                      How can we curb multiple/duplicate entries in to the database of the same form data.


                      Are you by chance using &gotoid= parameter? I think if you use gotoid to point to a different page, that refreshing the ending page does not resubmit POST data. This may be one way to prevent your issue.

                      Another possible solution is to use a plugin/snippet to create a unique SESSION_ID for the current user. If you can insert this SESSION_ID in your table during INSERT/UPDATE, write the logic to first check that the currently defined SESSION_ID does not exist in the table prior to INSERT, etc.

                      If you can’t alter your db table, you could always set some sort of BOOLEAN/FLAG on successful insert and store in PHP’s
                      $_SESSION
                      scope.

                      If eForm is throwing the message the form was already submitted, but db insert is still occuring, try using an alternate eForm custom function handler other than eFormOnBeforeMailSent, such as eFormOnMailSent (Thanks, TobyL!)

                      NOTE: I have updated the primary example to use this function.

                      I have done this before using and a custom preventDupes function:
                      &eFormOnBeforeFormMerge=`preventDupes`
                      



                      function preventDupes()
                      {
                      global $modx;

                      // Confirm if dupe
                      $checkDupe_sql = $modx->dbQuery(’
                      select
                      count(*) as count
                      from
                      your_database.your_table
                      where
                      session_id = "’.$_SESSION[unique_id_defined_earlier].’"
                      ’);

                      // NOTE: The above section could be modified to check for a flag stored in $_SESSION, rather than in the db table...

                      // Check that dupes don’t exist for provided temp_id
                      if( array_shift( $modx->fetchRow( $checkDupe_sql) ) > 0 )
                      {
                      // Set placeholders
                      $chunkArr = array(
                      ’dupe_entry’ => ’It appears you have already completed this action. Duplicate entries are not allowed. Thank you.’
                      );

                      // Output the dupe alert
                      echo $modx->parseChunk( ’dupe_entry_tpl’, $chunkArr, ’[+’, ’+]’ );

                      // Prevent form load
                      return false;
                      }

                      return true;
                      }

                      This is where dupe_entry_tpl is a Chunk containing a Duplicate Entry Error placeholder [+dupe_entry+] and any other markup for styling of the message, etc.

                      Just a possible way to help with dupe inserts...I’m not sure it’s the fault of either eform or eform2db, rather the result of one’s browser navigation behavior negatively impacting a simplistic design (e.g. The main eForm2db example is very simple and not very cautious)


                        Mike Reid - www.pixelchutes.com
                        MODx Ambassador / Contributor
                        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                        ________________________________
                        Where every pixel matters.