We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32025
    • 305 Posts
    Dayton Web Design Reply #1, 11 years ago
    First I wish there was a formz builder category it would make it easier when looking for questions.

    I have a few questions pertaining to Formz Builder that documentation does not address, and was hoping someone has already had these same questions and found a solution. Even if you only know one of these questions, please help with that one question, it would be much appreciated.

    1. First, I was wondering if anyone had figured out how to disable the form submission post to the database (database storage)? Meaning just have it sent via e-mail instead of saving to database? In the formTPL chunk I tried chaning this line: &store=`1` to &store=`0` thinking this was adding the data to the database but it did not seem to work. Don't need my client to have to constantly come in here and clean up all their former e-mails (there will be 5 forms with lots of submissions). An e-mail send is sufficient if possible.

    2. Also in the formTPL chunck I see this line: &storeTime=`900`. Is this 900 seconds, minutes, or days? And does the form being stored disappear on it's own after this time has elapsed?

    3. I am confused as to how to format the: Form Field Type: Radio and Select options. I am only getting 1 option with all my options comma separated. For example lets say I want multiple select drop downs with Option 1, Option 2, and Option 3. I do not know how to format. If I enter this: Option1, Option2, Option 3 in the "Values" field, I get 1 drop-down with all these variables, instead of multple drop-downs. Same thing with the Radio buttons only 1 is created instead of multiples. Can anyone help me here?

    4. ReCAPTCHA: I was able to add a reCAPTCHA to my forms and it almost works properly. I almost used the same method I use to display my FormIt reCAPTCHA. The problem is the form can be submitted (added to database and send an e-mail) even before the reCAPTCHA is filled out properly. Have you found the proper solution to display reCAPTCHA using formz builder?

    On the front end the submission message or redirect will not work until the reCAPTCHA is fille out, so it appears its working properly. This is an issue because SPAM bots can still send the e-mails (and save to database) even if reCAPTCHA is not yet completed.

    Here is what I have done to show my reCAPTCHA:
    in my formTL chunck I changed this:
    <span class="error">[[!+fi.successMessage]]
    [[!+fi.validation_error_message]]</span>
    
    <form class="form [[+identifier]]" action="" method="post">
    	<fieldset>
    		[[+fields]]
    	</fieldset>
            <div class="actions">
                    <input type="submit" name="submit[[+id]]" value="[[+action_button:default=`Submit`]]" class="btn primary" />
    	</div>
    </form>


    to this (added a few lines):
    <span class="error">[[!+fi.successMessage]]
    [[!+fi.validation_error_message]]</span>
    
    <form class="form [[+identifier]]" action="" method="post">
    	<fieldset>
    		[[+fields]]
    	</fieldset>
            <br class="clear" />
    	[[!+formit.recaptcha_html]] [[!+fi.error.recaptcha]]
    	<br />
            <div class="actions">
                    <input type="submit" name="submit[[+id]]" value="[[+action_button:default=`Submit`]]" class="btn primary" />
    	</div>
    </form>


    Then in my form extra fields I have added these hooks: recaptcha,spam

    I would love for the reCAPTCHA error fields to display, before it allows the submit button to save to database and/or send to e-mail, but am not sure how to do this. This would allow the reCAPTCHA to stop SPAM bots.

    In you have figured out any of these questions, your input and feedback would be much appreciated. I am just stuck on a few of theese issues (especially the select and radio button format).
      Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
      • 32025
      • 305 Posts
      Dayton Web Design Reply #2, 11 years ago
      #3 above has been answered here: https://forums.modx.com/thread/?thread=79567

      You add the pipe: Otion 1||Option 2||Option 3

      Alright 1 down a few more to go.
        Making the web a better place on site at a time! Dayton Web Design: http://www.dayton-web-design.com/
        • 46580
        • 167 Posts
        Thanks for your extra.

        Is there a way to send form data to external db?
        I created a custom db in modx, and package with CMPGenerator (http://rtfm.modx.com/extras/revo/cmpgenerator) and tried various way with hook to send write data in db, without success :-/

        I added formit2db in Formz Builder > Ectra tab > Hooks : formit2db
        and
        - tried by passing param via a custom formit chunk
        - tried with formit2db and a custom formzHookDBtest in "Hooks" field (formzHookDBtest)

        It would be really great to add a Save in "custom database" (General > Method) option...

        Another way would be to write a hook in order to do the job but I not really ready do do that.. -- I can write data in some custom db, but I didn't find a way to get form data from Formz field by field with this hook :

        <?php
        /**
         * try formz > custom db
         */
        $output = '';// this is what the snippet will return
         
        // add package so xpdo can be used:
        $package_path = $modx->getOption('core_path').'components/mytest/model/';
        // see the scheme file and the xml model element and you will see the attribute package and that must match here
        $modx->addPackage('mytest', $package_path);
        
        // lets add some data!
        // see the scheme file and the xml object element and you will see the attribute class and that must match here
        // the class name is taken from table names without the prefixed, and is capitalized.
        $myRow = $modx->newObject('Test');
        
        $name = 'oki'; //how to get 'name' field this from Formz ?
        $description = $hook->getValue('name'); //how to get 'description' field this from Formz ?
        
        echo $description;
        
        $data = array(
                'name' => $name,
                'description' => $description
            );
        $myRow->fromArray($data);
        
        if ( !$myRow->save() ) {
            $output .= '<p>Could not create row</p>';
        } else {
            $output .= '<p>Created row successfully</p>';
        }


        Your help will be welcome for these lines:
        $name = 'oki'; //how to get 'name' field value this from Formz ?
        $description = $hook->getValue('name'); //how to get 'description' field this from Formz ?

          MODX lover
          -
          Développeur MODX / Webdesign / Solutions web
          • 42161
          • 42 Posts
          Is there a way to use multiple instances of the same form on the same page?

          More specifically, I want to know if it's possible to use classes instead of ids in the input tags so that
          <input type="text" name="field1" id="field1" value="" class="text " size="40">

          would become
          <input type="text" name="field1" value="" class="text field1" size="40">

            • 20135
            • 188 Posts
            There seems to be a bug in the way that fields are added to an form in update (not create). Here's what I'm doing:

            Step 1: Create form in Formz Builder Component.
            Step 2: Add fields.
            Step 3: Save form and close.
            Step 4: Reopen form to edit.
            Step 5: (Here's where the bug occurs) Add new fields.

            On completion of the creation of a new field, the field is added into position 2 rather than at the end of the current list of fields. This happens regardless of any custom sorting of rows.

            Has anyone else come across this? How do I make sure that the fields are added to the end of the field list?


            EDIT: I submitted a bug report on github: https://github.com/Adido/formz/issues/18
              • 36426
              • 197 Posts
              Hi I've submitted a few bugs for Formz and there are lots still open... with the last release update or patch from 4 years ago - is this extra no longer supported by Adido? I could really do with some help on the bugs I have if anyone can take on this extra?
                Yorkshire UK based hosting provider: https://www.simulant.uk