We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40944
    • 78 Posts
    Hi,

    I don't use ModX often, so it is a lot of searching for the right snippets. Currently I am building a website for a horse-club. They have competitions and want to let people sign up via the website. So I got FormIt which is great. But I want to display a table of everyone that has already signed up.

    So the form contains a few fields: (full) name, e-mail, the horse they will be riding, category and particularities. So I searched for a snippet that would save the subscriptions to the database and would enable me to display a table of participants. I used FormSave which works great by the way. The snippet however, only displays a table in the manager and it is possible to export it to print, cvs and xml.

    So I tried using Rowboat to print a list of participants on the same page as the subscription form is on. But (of course) FormSave saves all my 'custom' fields to ONE column in a JSON string, cause it can't know which columns I want to save. I used rowboat to put the data in a JSON string anyway, and printed a table. But this is not what I want at all. All the data is in there, so there are e-mail addresses and particularities on a public page.

    So finally my question: is there a snippet which is pretty much the same as FormSave, but enables me to choose which columns to display on a public page?

    Thanks in advance,
    Erwin
      • 3109 ☆ A M B ☆
      • 894 Posts
      You should be able to display the fields you want using the &columns parameter in rowboat.

      Check out the documentation on how to accomplish this.

      Good Luck.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 40944
        • 78 Posts
        Thank you for your reply.

        I did indeed use &columns with rowboat, but FormSave saves all data to one column in the database. This is only logical because FormSave doesn't know what columns to create in the database. So what it does is create a table with a column 'data' and some other columns with metadata such as an ID, time... etc.

        So when selecting the 'data' column I get a JSON string with all the fieldvalues from the form.
          • 3109 ☆ A M B ☆
          • 894 Posts
          It seems like you will have to create a custom snippet to parse the JSON string that FormSave gives you, did you try using something like FormIt2DB instead of FormSave?

          If not try one of these extras, hopefully one of them will work.

          Good Luck.
            Benjamin Marte
            Interactive Media Developer
            Follow Me on Twitter | Visit my site | Learn MODX
            • 40944
            • 78 Posts
            I thought(/think) that is a snippet to fill out a form, that already has values in the database (for example a user setting page, where there already settings set, but you can change them).

            But I will look into it and report back about any results.
              • 40944
              • 78 Posts
              It seems my expectations were true: it is just to load values into a form.

              I guess this means I will either have to adjust the formsave snippet to save to a custom table (which I don't think will work with my current php and modx knowledge. Or create a snippet which reads the JSON and outputs the correct data.

              I guess I will also file a request with the FormSave creators.

              If there are any other solutions: please tell me, I have got e-mail notifications on, so I will look into all replies.
                • 37514
                • 178 Posts
                Quote from: might-e at Apr 07, 2013, 09:44 AM
                It seems my expectations were true: it is just to load values into a form.

                Hi there, I don't think that is right, I think it is both save from (Formit2db) or place into (db2Formit) reading the Installation instructions on that page.

                There's also a discussion linked from it which explains what it's meant to do.
                  • 40944
                  • 78 Posts
                  Sorry, of course you guys were right. I wasn't thinking straight. It saves forms to the database, I can use rowboat to display a table on the page.

                  When I find time I will figure out how to create the correct classes (?) using migx so I can use formit2db. Thank you for your time.
                    • 40944
                    • 78 Posts
                    I don't know if I should create another topic for this, but I can't get it to work.

                    I created a package with CMP Generator, because MIGX didn't seem to do anything (it just said 'success' but didn't show anything apart from that). So I got my package in CMP Generator and edited my formit2db call to:
                    [[!FormIt? &hooks=`spam,email,formit2db,redirect` &prehooks=`db2formit` &packagename=`evdpackage` &tablename=`inschrijvingen` &emailTo=`[email protected]` &emailUseFieldForSubject=`[[*pagetitle]]` &redirectTo=`1` &fsFormTopic=`[[*pagetitle]]`]]

                    When trying to send the form it just says "Failed to create object of type:"

                    So I checked out the formit2db snippet and noticed the classname parameter and adjusted my call accordingly:
                    [[!FormIt? &hooks=`spam,email,formit2db,redirect` &prehooks=`db2formit` &packagename=`evdpackage` &tablename=`inschrijvingen` &classname=`inschrijvingen` &emailTo=`[email protected]` &emailUseFieldForSubject=`[[*pagetitle]]` &redirectTo=`1` &fsFormTopic=`[[*pagetitle]]`]]

                    This gives the error: "Failed to create object of type: inschrijvingen

                    Does anyone know what I am doing wrong? (or should I post another topic?)