On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • thanks for the link, it doesn’t explain how to receive the db saved fields.
    anyone did this? without using phpmyadmin to dl the db?
      Evolution user, I like the back-end speed and simplicity smiley
    • What do you mean by "receive the db saved fields"?
      • There are a number of ways you can do this, depending on your client’s requirements. You could create a Manager module to manage the DB, including generation of .csv or .sql for download.

        You could use the eFormOnBeforeMailSent event to format the data into .csv or .sql files, then attach the file to the report email.

        You could create a secured front-end page with a snippet to retrieve the data and either display or generate the .csv or .sql file for download.
          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: cipa at Jan 13, 2011, 02:17 AM

          What do you mean by "receive the db saved fields"?

          I don’t have the knowledge to script this myself, i have no db and php skills.
          Offcourse i can choose to download the csv with phpmyadmin, but i rather have a link on a secured page where my client can download the csv file (with all entered fields listed).

          So wondered if this snippet had it of if there was already made a snippet for it.


          Dunno if Sottwell solution can be done without scripting? create a manager module? shocked
            Evolution user, I like the back-end speed and simplicity smiley
          • Found something : http://wiki.modxcms.com/index.php/EForm_to_CSV

            will try this if i have a go
              Evolution user, I like the back-end speed and simplicity smiley
            • hi! I just recently found about this snippet that did what I was trying to do.
              first, I found the wiki article which I edited to fit my needs.
              The form to input the data showed well, but after submitting the data it did nothing, just showed again the start page and, of course, no data was inserted to the table.
              I then copied exactly the code in the example. no luck, same behavior. And no mather what I put as debugging info in my function, it was as if it was never run.
              after hours reading the forum and trying every solution I didn’t know where to search.
              looking at the source code in the page where I had the formin the form tag, it sayed:
              <form action="es/nuevo-tema.html".............

              yes, I use friendly urls.
              but every other link created by wayfinder, started with a "/"
              /es/Bienvenido.html
              etc..........

              so I added a / in my form action:
              <form action="/[~[*id*]~]"..................

              and this did the trick.
              I don’t know exactly why but if you are as lost as I was, you may try it...
              Regards Abner
              Magic Creations
              • I have found a working solution in regards to the duplicate entries problem.
                Following the steps on on modx wiki:http://wiki.modxcms.com/index.php/Use_eForm_to_Store_data_into_Database do the following:
                first
                we will change this step by adding UNIQUE in the fields we don't want to be duplicated. For instance, if we have an email field do this:
                CREATE TABLE `cargas` (
                  `id` int(10) unsigned NOT NULL auto_increment,
                  `email` varchar(255) NOT NULL UNIQUE,
                  PRIMARY KEY  (`id`)
                );


                second
                This step can remain the same as it is described in the modx wiki.

                third
                We need to change the part of our snippet where we run the db insert query(we change the
                $dbQuery = $modx->db->insert($dbTable, 'cargas' );
                in order to run an INSERT IGNORE query. This way duplicate entries will be ignored on UNIQUE fields).

                <?php
                function agregarCargas( &$fields )
                    {
                    global $modx;
                    $dbTable = array();
                    $dbTable['email'] = $modx->db->escape($fields['email']);
                    $usermail=$dbTable['email'];
                    $result = $modx->db->query("INSERT IGNORE INTO modx_cargas(email)
                    VALUES('$usermail')");
                    return true;
                    }
                ?>


                Remember that you can have only one primary key but as many UNIQUE fields as you want. And if you don't want the "This form was already submitted succesfully. There is no need to submit your information multiple times." message to appear then add this to your snippet call:
                &protectSubmit=`0`
                Otherwise you can leave the corresponding messages blank in assets/snippets/eform/lang/YOUR_LANG.inc.php to get rid of unwanted messages. That's what i did for the thank you message, but keep in mind that will make the messages not to appear in all eform calls so choose wisely. [ed. note: dinpapa last edited this post 4 years, 8 months ago.]
                • Hello, everyone. Can you please help me with eForm? I have a form with several <select> fields. One of <options> field has a value as "your own document type/own number". And if you choose it the one more text field is fade in to enter your own "document type" or other. And the problem is that eForm is requires you to fill that "your own document" field even if it is hidden. Is there a fix of it without changing the eForm snippet?
                  • Oke, I have it working.

                    The issue I had was Creating the DB.
                    It did work when creating it like this:

                    CREATE TABLE `my-db-table` (
                      `id` int(10) unsigned NOT NULL auto_increment,
                      `name` varchar(255) NOT NULL,
                      `adres` varchar(255) NOT NULL,
                      `phone` varchar(255) NOT NULL,
                      `email` varchar(255) NOT NULL,
                      PRIMARY KEY  (`id`)
                    );



                    ENGINE=MyISAM DEFAULT
                    and ENGINE=INNODB DEFAULT gave an error.
                      Evolution user, I like the back-end speed and simplicity smiley
                    • Any idea why the module doesn't work?
                      The only issue I have is when I click on the module I see [+name+] and [+comment+] and the link also isn't "parsed" db=[+recID+].

                      Anyone got a clue whats wrong?

                      Everything besides that works (saving fields in the DB)
                        Evolution user, I like the back-end speed and simplicity smiley