We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21334
    • 3 Posts
    I have to do a 4-5 form on my website.. the results should be saved to a database.
    Kindly tell me which module I should use. There are so many, I am confused. Sorry for asking a basic question.
    Thanks a lot in advance.
    • Which version of MODx?

      I’m doing something similar in Evo. I have the initial form supplied by WebLoginPE in Register mode, as I want this initial info to be applied to a web user. I have a plugin using OnSaveWebUser to load the POST into the SESSION so it will be available to auto-fill any fields with a "same-as-user-data" checkbox.

      The WLPE successful submission forwards to the next page, which uses eForm and a set of custom tables. The form is all on one page, and uses JQuery tabs to emulate a progress bar and to show/hide the parts of the form. Each part is saved on completion via AJAX.

      Anybody without Javascript will just get the whole form on the page, which is an acceptable fallback in this case.
        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
        • 21838
        • 284 Posts
        For Revo I would use formIt and transmit the send variables via FormItRetriever and then save in a custom table.
          MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
          • 21334
          • 3 Posts
          Thank you Susan.
          But being a beginner, I am afraid I couldn’t completely understand what you meant.
          I hope I should be using the latest version of MODx..
          My doubts are how I should paginate the form,
          (The form has lots of input boxes etc..) so should I create a custom table for this?
          Thank you.
          @smooth-graphics - thank you for your reply as well.
            • 22019
            • 390 Posts
            First - does it need to be a multi-page form. What sottwell is doing is mimicking a multi-page process, while actually only using one page (it’s more complex than that, but this is the gist). You could use an accordion feature to show or hide form elements, to make it seem less long.

            If you _must_ paginate it, then the simplest solution in Revolution is as smooth-graphics says - chain the pages using FormIt and FormItRetriever

            Resource 1 - FormIt - redirect to resource 2 on completion
            Resource 2 - FormItRetriever - retrieve all the variables into hidden fields in a new FormIt form - redirect to resource 3 on completion
            Resource 3 - FormItRetriever - retrieve all the variables from both resources 1 and 2, into hidden fields if you want to add yet more fields (with another FormIt).

            You don’t _have_ to save to a database - you could just email the results at the end of the chain, but it would probably make more sense to store it - in which case you will need to write a custom snippet to run as a ’hook’ on your last FormIt, that saves the data to a custom table. In order to do that, you will need to create a MODx object for that table - there is a tutorial on that here :

            http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components

            It sounds more complicated than it actually is, you just need to get used to it.
              Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
              • 21334
              • 3 Posts
              Thank you very much odeclass. It is getting clearer now.
              I am thinking of pagination as it is a massive form.
              I would also like to add inline validation like ( http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ )- show the user error messages etc., as soon as he/she leaves the input field - instead of waiting till the end.
              And to display tooltips when a user enters a particular form field.
              Hope these two are possible.
              Saving to a database is mandatory here.. as reports may be required based on the values entered.
              Thanks again.
              • Whatever Javascript you want to add is up to you; MODx doesn’t care at all about that. The only thing to consider is if your scripts cause conflicts among themselves, but again that’s not really a MODx problem.

                With Evo, I just turn off the QuickManager loading of jquery, and hard-code it directly in the template. So far QM has been perfectly happy with the three latest versions of JQuery that I’ve used.
                  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
                  • 26921
                  • 4 Posts
                  u can use formprocessor. it is good