We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    MODx 2.3.5 site (soon to be updated to 2.4x)
    What method or add-on do others recommend for posting sumbmitted formit form to a database?
    Would FormIt2db be a good solution?

    Other questions:
    Can an email still be sent.
    She I create a new database specifically for use with the formit form?
      • 47401
      • 295 Posts
      Hi Mmcgee

      We use FormSave. This is available from the modx add-ons website (not the installers) and you have to install it manually. Works better than formit2db, and just simply saves the form data to the database.

      https://rtfm.modx.com/extras/revo/formsave


      Yes email can still be sent. FormSave is used in conjunction with FormIT (i.e you need Formit to be installed)
      You dont need to create any databases, the add-on does everything for you.

      The formsave add-on works fine with your version
        • 19872
        • 1,078 Posts
        Thanks for the suggestion on this. Haven't started the process yet, but will give this a try.
        Quote from: comp_nerd26 at Nov 23, 2015, 05:24 PM
        Hi Mmcgee

        We use FormSave. This is available from the modx add-ons website (not the installers) and you have to install it manually. Works better than formit2db, and just simply saves the form data to the database.

        https://rtfm.modx.com/extras/revo/formsave


        Yes email can still be sent. FormSave is used in conjunction with FormIT (i.e you need Formit to be installed)
        You dont need to create any databases, the add-on does everything for you.

        The formsave add-on works fine with your version
          • 30585
          • 833 Posts
          FormSave is included in the latest version of Formit as a hook called FormItSaveForm. Here's how you use it:
          [[FormIt?
            &hook=`FormItSaveForm,email,redirect`
            &formName=`myFormName`//The name of the form in the CMP
            &formFields=`fieldOne,fieldTwo,etc.`//If not specified, will save all fields including the submit button.
            ...
          ]]

          Saved forms will be available in a CMP accessible via the top menu under Extras -> FormIt. Here's a complete list of all available properties. [ed. note: treigh last edited this post 8 years, 5 months ago.]
            A MODx Fanatic
            • 19872
            • 1,078 Posts
            Hi Treigh:
            This is more than helpful. Thank you for sending this information. I am now less anxious and can't wait to try this out.
              • 19872
              • 1,078 Posts
              Just gave this FormItSaveForm an initial trial run. Very easy to implement.

              I am running in to a couple of issues though. Maybe some of this is my form code, and maybe some is the default nature of how FormItSaveForm captures the info.

              FormItSaveForm puts "all" of the values into one table cell. I exported a CSV of my first trial submission, and everything is in one string. First, all of the form field names, then the values. So between some items being completed and others not, it's a bit tricky to determine which values go with which fields. My form is a bit complex, with a lot of fields, so maybe FormItSaveForm is not the best solution?

              The other thing I noticed, and maybe this is a problem with my form. I copied and pasted text into the message field, but received an error that this "required" field was empty. If I type directly into the message field, the form successfully submits. However — the values of the fields above this message field, that we already filled out, had the entered values displayed in my error message areas that appear directly below each field. Very odd. At any rate, after submitting the form, those items were not included in the database. I assume that the semi-colon is indicative of a field containing no value.

              If I am able to resolve some of the form issues — how do I manage these items when viewing in the formit manager. Can I delete specific form submissions from this area, or would that have to be done via phpMyAdmin? It may be fine that all of the contents are stored for perpetuity, as I don't think I would want to turn a website manager loose in the same database that also contains entire website.

              Update:
              Working on iMac, just discovered that I can hold "control" and select a form and either view or deleted. Very handy. So in this scenario, I am able to view a form, then highlight, copy and paste. This will meet my needs. In a perfect world, it would be awesome if I could export, or access everything in a fashion that code then be sorted (i.e., I could access all forms sent by so and so from such and such email address, etc.)

              Question about Names vs. IDs
              When listing my fields for the &formFields=, am I supposed to enter the field name or the field id. This have always been confusing to me. Here is one scenario I have come accross. I have a check box. It's ID is "checkbox1". It's NAME is "senderInfo[]" . On my first trial here, I used the ID. Even though I checked the box as part of the form test, no result was transferred to the database. Should I change my hook to reflect the field name of "senderInfo[]" instead.
              [ed. note: mmcgee last edited this post 8 years, 4 months ago.]
                • 19872
                • 1,078 Posts
                Still troubleshooting the form but having a bit more success.

                First, I modified my FormItSaveForm hook field name for my checkbox by using it's name "senderinfo[]" instead of its ID "checkbox1".

                This time around, I was able to paste text into the message field and the form submitted successfully. No validation error about the message field requiring content. So maybe that was just a fluke, or maybe it had something to do with the name i was inserting into the hook. huh

                The value for my checkbox howerver, does not get posted to the database though. In reviewing the submitted form in the FormIt manager, only the label of "senderInfo[]" appears. This would be confusing if collecting the data from within the FormIt manager. The email generated from the form submission does contain the value of the checked box.


                UPDATE
                Changed senderInfo[] to senderInfo in my hook, and now the value for the checked box gets included in the database.

                All seems to be working fine now.

                My apologies for the stream of process here with getting this up and running.

                REFLECTION
                I think this solution of FormItSaveForm is very easy to implement. Upon review, it works perfect for my current needs.
                While viewing each form is convenient and easy within the manager, I don't see a clear way to export and through the info into a spreadsheet for further sorting, since all form fields are collected together in the values cell. Maybe I am overlooking some available feature, or still falling short in the way I have my hook constructed?

                [ed. note: mmcgee last edited this post 8 years, 4 months ago.]
                  • 4172
                  • 5,888 Posts
                  If you want your form-submissions saved to special custom-tables for easier filtering/sorting, you can use formit2db
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 19872
                    • 1,078 Posts
                    Hi Bruno:
                    Thanks for the feedback. I will have a need for easier filtering/sorting on another set of forms, so plan to give formit2db a try.

                    Quote from: Bruno17 at Nov 30, 2015, 06:00 AM
                    If you want your form-submissions saved to special custom-tables for easier filtering/sorting, you can use formit2db