We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I'm imagining using MIGX as a cheap-o way to build and manage simple forms. "I know this sounds crazy, but it just might work".

    Each record would be a form field. Each would have the following values

    • Field Type (text|hidden|textarea|select|radio... etc)
    • Name
    • ID
    • Class
    • Label
    • Input Options
    • Default Value
    • Validators

    This MIGX TV would go in a "Form" template, along with a few other TVs like "action", "method", etc.

    Then you'd have some sort of a snippet call that processed the TV and generated a form using tpl chunks.

    I know this wouldn't work for forms that were very complicated, but for simple stuff? Am I missing something? I think I'll try a proof-of-concept and see how it goes.
      • 4172
      • 5,888 Posts
      Did kind of that several times and its working nice.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 40045
        • 534 Posts
        yep, sure this would work, also thought about it, but then charles came with his mxformbuilder, which is also quite nice, when it will be available =)
          • 4172
          • 5,888 Posts
          here you go to get started:
          https://github.com/Bruno17/migxFormbuilder
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 36722
            • 101 Posts
            Bruno, nice contribution here, but I can't seem to find the documentation on it.
              Shawn Himmelberger
              Himmelberger Design
              https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Design | https://himmdesign.com/services/website-development/modx"" target="_blank" rel="nofollow"> MODx Web Development
              • 4172
              • 5,888 Posts
              sorry, there isn't. Didn't had the time to do any, yet.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 40045
                • 534 Posts
                As Brunos time is better invested in creating new awesome MIGX stuff I'll try to document my first attempt with migxFormbuilder =)

                0. Make sure you have FormIt and bloX (https://github.com/Bruno17/bloX/blob/master/packages/blox-1.2.1-beta3.transport.zip) installed, as migxFormbuilder seems to build on top this extras (I had an installation error with bloX 1.2.1beta3 and had to copy/paste the snippet code manually in the manager, using 2.2.8pl and MIGX 2.5.4pl)
                1. Download the package from https://github.com/Bruno17/migxFormbuilder/blob/master/packages/migxformbuilder-1.0.9-pl.transport.zip
                2. Copy the package to your MODx installation at core/packages/
                3. Go to Package Management in the manager and when loaded click "Search for packages locally" in the dropdown menu
                4. The migxFormbuilder package should show up as uninstalled package in the grid, install it
                5. Reload the manager and go to Componentes > migxFormbuilder
                6. In the CMP click the Button "Create Form"
                7. Create a Form and the corresponding fields, Save it

                here I also get stuck =), how can I add the created form to the frontend? Do I need Formit and BloX? And which snippet to use to build the form with what kind of params? I guess &form_id and &task (and eventually &debug_formit)?

                According to https://github.com/Bruno17/bloX it could be something like

                [[bloX?
                	&packagename=`migxformbuilder`
                	&component=`migxformbuilder`
                	&project=`migxformbuilder`
                	&classname=`mfbForm`
                	&task=`buildform`
                	&form_id=`1`
                	&debug_formit=`0`
                ]]
                


                If I put this in a resource content field, the before created form actually shows up (kind of a big thing as I was just trying around =D), but when I fill it out and send it, nothing happens, neither to the db nor is an email sent (both were checked in the form configuration initially, then disabled save to db and just want the email, but didn't help). I have errors like the following in the log:

                Array
                (
                    [0] => 42S02
                    [1] => 1146
                    [2] => Table 'tablename.modx_migxformbuilder_forms' doesn't exist
                )
                
                [2013-07-09 13:15:37] (ERROR @ /assets/components/migx/connector.php) Error 42S02 executing statement: 
                Array
                (
                    [0] => 42S02
                    [1] => 1146
                    [2] => Table 'tablename.modx_migxformbuilder_formrequests' doesn't exist
                )
                
                [2013-07-09 13:15:49] (ERROR @ /assets/components/migx/connector.php) addPackage called with an invalid package name.
                


                The table "tablename.modx_migxformbuilder_forms" is actually there, the "tablename.modx_migxformbuilder_formrequests" is not...I created the table manually via MIGX Config CMP (packagename "migxformbuilder" > XML Schema (Load schema) > parse Schema > Create Tables) but even when there the form submissions do not get logged...these errors seem to come from using the cmp (or installation?) because when the form is submitted (without any effect), nothing is logged, when debug_formit is set to true I just get an array of FormIt settings printed out in the frontend, but that seems to be more or less correct (homephone is not added by myself, it seems to be added automatically as a hidden field to prevent spam with the honeypot method)

                Array
                (
                    [hooks] => mfb_form2db,email,redirect
                    [validate] => homephone:blank,firstname:required,lastname:required,address:required,city:required,email:required:email
                    [packagename] => migxformbuilder
                    [classname] => mfbFormRequest
                    [emailTo] => [email protected]
                    [emailSubject] => MIGXFormbuilder Test
                    [emailTpl] => migxFormReportTpl
                    [redirectTo] => 202
                )
                


                EDIT: When save to db is enabled again I get the following error when submitting the form:

                [2013-07-09 14:03:34] (ERROR @ /assets/components/migx/connector.php) Error 42S02 executing statement: 
                Array
                (
                    [0] => 42S02
                    [1] => 1146
                    [2] => Table 'tablename.modx_migxformbuilder_formrequests' doesn't exist
                )
                
                [2013-07-09 14:03:39] (ERROR @ /assets/components/migx/connector.php) addPackage called with an invalid package name.


                I'm pretty sure that these come from a wrong bloX config param, but that's not too surprising because I just guessed the params, so any hint how to correct this would be very welcome =).

                Another problem that occured was what should happen after the form is submitted, it somehow messes up the URI...as I guess if nothing is specified in the "Select a ThankYou Page"-dropdown, it should stay on the page the form is included in (after submit), but it changes the address to domain.tld/de/outsites/outsites/labs.html (when the form is located at domain.tld/de/outsites/labs.html)...this problem persists when a resouce is selected in the TankYou Page dropdown...

                Additionally it would be nice if we could specify the text shown in the submit button (inside the Form configuration).

                To be able to select ThankYou resources from the form config dropdown, you need to specify the parent resource in the system settings for migxformbuilder! I can also not select anything in the "Select a ThankYou page" dropdown in the form configuration, the dropdown is just empty. I would also find it nice to have (may additional to the resource dropdown) a textarea where a Thank-You-Text could be placed (maybe even richtext?) which would replace the form markup after the form is successfully submitted (or display an error message = another richtext-area when an error showed up). This would probably be very easy to add if the config file for migxformbuilder would be listed in the main MIGX configurator (under configs) and could be edited there...can you give me a hint where this file is living?) [ed. note: exside last edited this post 13 years, 3 months ago.]
                  • 4172
                  • 5,888 Posts
                  for a single-page-form there is this chunk:
                  https://github.com/Bruno17/migxFormbuilder/blob/master/core/components/migxformbuilder/elements/chunks/migxformbuilder.chunk.html

                  try:
                  [[$migxformbuilder? &form_id=`yourFormid` &debug_formit=`0`]]


                  create the tables before using them within the MIGX - package - management:

                  package: migxformbuilder
                  'create tables'

                  if you want to have your own configurations, you can import them with 'import from package'
                  and remove the :migxformbuilder from the menue-action-params

                  There is also this chunk for multipage-forms
                  https://github.com/Bruno17/migxFormbuilder/blob/master/core/components/migxformbuilder/elements/chunks/migxformbuildermultipage.chunk.html

                  use it:
                  [[$migxformbuildermultipage? &form_ids=`2,3,4,5` &debug_formit=`0`]]


                  [ed. note: Bruno17 last edited this post 13 years, 3 months ago.]
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 40045
                    • 534 Posts
                    Did create the tables manually, so that seems to be fine.

                    I replaced my bloX snippet call with the one from your single page form chunk, so it looks like this now:

                    [[!bloX? 
                    &packagename=`migxformbuilder`
                    &component=`migxformbuilder`
                    &project=`migxformbuilder`
                    &task=`buildform`
                    &form_id=`1`
                    &debug_formit=`1`
                    ]]
                    


                    but I still don't have any output when the form is submitted, neither db record or email sent. When I save the form from the CMP I always get the following error logged:

                    [2013-07-09 16:37:51] (ERROR @ /assets/components/migx/connector.php) addPackage called with an invalid package name.
                    


                    also tried to log some stuff like

                    $modx->log(modX::LOG_LEVEL_ERROR, 'scriptProperties ' . print_r($scriptProperties,1));
                    


                    in mfb_formit2db snippet, but somehow nothing gets logged, as if the hook is not triggered (but it seems to be in the params for formit as shown in the post below)...
                      • 4172
                      • 5,888 Posts
                      Have this running on a handfull installations now.

                      But I think, I will need to do a fresh installation on a fresh system, before I can say where it may hang and what installation/usage-steps are needed.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!