We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/596">FormIt 1.0-rc1</a> by splittingred.

    Brief Description:
    Automatically validate, parse and email forms. Redirect to thank you pages. Add your own hooks as Snippets to handle forms dynamically. Validate with custom Snippets. All is possible in FormIt, the new form processing Snippet for MODx Revolution 2.0.



    - Added missing formit.contains lexicon entry

    - Fixed possible loophole with $this->fields and referencing in multiple hooks



    See the Official Documentation here:

    <a href="http://svn.modxcms.com/docs/display/ADDON/FormIt">http://svn.modxcms.com/docs/display/ADDON/FormIt</a>
      • 20364
      • 89 Posts
      I cannot seem to install this. It appears to download OK, but when I hit install, it pops up "Package Not Found". Tried multiple times.
        • 25483
        • 741 Posts
        It would be nice if "emailTpl" is optional, If it’s not set it should just mail all fields in the form off:

        FIELD_NAME: Value of FIELD_NAME
        FIELD_NAME: Value of FIELD_NAME
        FIELD_NAME: Value of FIELD_NAME
        FIELD_NAME: Value of FIELD_NAME

        I also made a Dutch translation for FormIt:
        <?php
        /*
         * @topic default
         * @namespace formit
         * @language nl
         */
        $_lang['formit.contains'] = 'Het veld moet de volgende waarde bevatten: "[[+value]]".';
        $_lang['formit.email_invalid'] = 'Vul een geldig email adres in.';
        $_lang['formit.email_invalid_domain'] = 'Het email adres heeft geen geldige domeinnaam.';
        $_lang['formit.email_no_recipient'] = 'Voer de ontvanger of ontvangers voor deze email in.';
        $_lang['formit.email_not_sent'] = 'Er is iets fout gegaan tijdens het verzenden van de email.';
        $_lang['formit.email_tpl_nf'] = 'Er is geen email template opgegeven.';
        $_lang['formit.field_not_empty'] = 'Het veld moet leeg zijn.';
        $_lang['formit.field_required'] = 'Het veld is verplicht.';
        $_lang['formit.max_length'] = 'De invoer mag niet langer zijn dan [[+length]] tekens.';
        $_lang['formit.max_value'] = 'De invoer mag niet groter zijn dan [[+value]].';
        $_lang['formit.min_length'] = 'De invoer moet minstens [[+length]] tekens lang zijn.';
        $_lang['formit.min_value'] = 'De invoer mag niet kleiner zijn dan [[+value]].';
        $_lang['formit.not_number'] = 'De invoer moet een geldig nummer zijn.';
        $_lang['formit.password_dont_match'] = 'De wachtwoorden zijn niet hetzelfde.';
        $_lang['formit.password_not_confirmed'] = 'Bevestig het wachtwoord.';
        $_lang['formit.range_invalid'] = 'Ongeldig bereik ingevoerd.';
        $_lang['formit.range'] = 'De invoer moet tussen de [[+min]] en [[+max]] zijn.';
        $_lang['formit.username_taken'] = 'Gebruikersnaam al in gebruik. Kies een andere';
        ?>
        

          with regards,

          Ronald Lokers
          'Front-end developer' @ h2o Media

          • 3749
          • 24,544 Posts
          Is there an easy way to integrate JS validation with Formit so the built-in (and custom) validators do the validation, but it’s done prior to submission?
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 3749
            • 24,544 Posts
            How can a custom hook (snippet) return error messages? There’s no $this->errors[] to attach them to.

            Would it make sense to send a reference to the fiHooks class instance as an argument to them?

            [UPDATE] Never mind, I see it’s already there in the properties. I forgot for a second that I was working with geniuses. wink
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 28215
              • 4,149 Posts
              Quote from: BobRay at Feb 24, 2010, 10:33 PM

              How can a custom hook (snippet) return error messages? There’s no $this->errors[] to attach them to.
              [UPDATE] Never mind, I see it’s already there in the properties. I forgot for a second that I was working with geniuses. wink

              You can either use $scriptProperties[’hook’]->errors, or return an array. The array will be parsed and added to the errors. ie:

              return array(
                 'email' => 'Bad email address!',
                 'subject' => 'Lame subject!',
              );
              

              Will return error messages for the subject and email.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 3749
                • 24,544 Posts
                If you return the array (instead of false), won’t Formit interpret that as success and proceed to the next hook in the list (possibly redirect)?

                Wouldn’t it be better to return false and set the error placeholders in the form?
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 28215
                  • 4,149 Posts
                  Quote from: BobRay at Feb 25, 2010, 11:57 PM

                  If you return the array (instead of false), won’t Formit interpret that as success and proceed to the next hook in the list (possibly redirect)?

                  Nope - it only interprets it as success if you return true.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 3749
                    • 24,544 Posts
                    Quote from: splittingred at Feb 26, 2010, 07:42 AM

                    Quote from: BobRay at Feb 25, 2010, 11:57 PM

                    If you return the array (instead of false), won’t Formit interpret that as success and proceed to the next hook in the list (possibly redirect)?

                    Nope - it only interprets it as success if you return true.

                    Right. I was looking at the wrong bit of code.

                    Is this accurate?

                    If any hook doesn’t return true, the hooks after it in the &hooks parameter won’t execute.
                    If a hook isn’t found, the hooks after it *will* execute.

                    BTW, for the spam hook, the &spamEmailFields parameter doesn’t seem to be required (since it defaults to ’email’). Do you want me to fix that in the docs?
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 28215
                      • 4,149 Posts
                      Yes and yes. Thanks Bob.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com