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 FormIt 1.0-alpha1 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.

    Only for MODx Revolution 2.0-beta4 and beyond.

    Official documentation: http://svn.modxcms.com/docs/display/ADDON/FormIt
      • 17499 ☆ A M B ☆
      • 872 Posts
      Does it replace eform?
        • 28215
        • 4,149 Posts
        Ideally, yes. An example contact form:

        [[FormIt?
           &hooks=`email,redirect`
           &emailTpl=`myEmailChunk`
           &emailTo=`[email protected]`
           &redirectTo=`123`
        ]]
        
        <h2>Contact Form</h2>
        
        <p>[[+fi.error.message]]</p>
        
        <form action="[[~[[*id]]]]" method="post" class="form">
            <input type="hidden" name="nospam:blank" value="" />
        
            <label for="name">Name:[[+fi.error.name]]</label>
            <input type="text" name="name:required" id="name" value="[[+fi.name]]" />
        
            <label for="email">Email:[[+fi.error.email]]</label>
            <input type="text" name="email:email:required" id="email" value="[[+fi.email]]" />
        
            <label for="subject">Subject:[[+fi.error.subject]]</label>
            <input type="text" name="subject:required" id="subject" value="[[+fi.subject]]" />
        
            <label for="text">Message:[[+fi.error.text]]</label>
            <textarea name="text:required:stripTags" id="text" cols="55" rows="7">[[+fi.text]]</textarea>
            
            <br class="clear" />
        
            <div class="form-buttons">
                <input type="submit" value="Send Contact Inquiry" />
            </div>
        </form>
        
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 17883
          • 1,039 Posts
          Sounds great!

          One suggestion:

          # <h2>Contact Form</h2>  
          #   
          # <p>[[+fi.error.message]]</p>  
          #   
          # <form action="[[~[[*id]]]]" method="post" class="form">  
          #     <input type="hidden" name="nospam:blank" value="" />  
          #   
          #     <label for="name">  
          #         Name:  
          #         <span class="error">[[+fi.error.name]]</span>  
          #     </label>  


          How about an error message function where (custom) HTML tags and classes are only displayed if an error occurs. Because validating fails if there are empty (and unnecessary) tags. Like:

          # <h2>Contact Form</h2>  
          #   
          # [[+fi.error?name=`message` &tag=`p`]]  
          #   
          # <form action="[[~[[*id]]]]" method="post" class="form">  
          #     <input type="hidden" name="nospam:blank" value="" />  
          #   
          #     <label for="name">  
          #         Name:  
          #         [[+fi.error?name=`name`]]  
          #     </label>  
          #     <label for="email">  
          #         Email:  
          #         [[+fi.error?name=`email` &class=`myError`]]  
          #     </label>  
          #     <input type="text" name="email:email:required" id="email" value="[[+fi.email]]" />
          


          would output something like:

          # <h2>Contact Form</h2>  
          #   
          # <p class="error">Some errors occured</p> 
          #   
          # <form action="[[~[[*id]]]]" method="post" class="form">  
          #     <input type="hidden" name="nospam:blank" value="" />  
          #   
          #     <label for="name">  
          #         Name:  
          #         <span class="error">Name is missing</span>  
          #     </label>  
          #     <label for="email">  
          #         Email:  
          #         <span class="MyError">E-Mail is not valid</span>  
          #     </label>  
          #     <input type="text" name="email:email:required" id="email" value="[[+fi.email]]" />
          


          span and class "error" are default, if you want something other, you can put it in the error placeholder as parameter.
            • 7455
            • 2,204 Posts
            Nice work

            does it have the event that eForm has?
            and do I mis the report chunk?

            thos tevents etc that efom has are the thinks we use the most, eForm is more than just a contactform validator, we use it for all sort of forms some that have a part of the form and a part of the report generated dynamicly by Ditto
            How could you do something like that using FormIt?
              follow me on twitter: @dimmy01
              • 28215
              • 4,149 Posts
              Quote from: MadeMyDay at Oct 19, 2009, 05:55 PM

              Sounds great!
              One suggestion:
              How about an error message function where (custom) HTML tags and classes are only displayed if an error occurs. Because validating fails if there are empty (and unnecessary) tags. Like:

              span and class "error" are default, if you want something other, you can put it in the error placeholder as parameter.
              Howabout a &errorTpl parameter than you can wrap error messages in? That would be better than putting HTML into the snippet code. (And properties cant have properties on them, as in your example.)
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 28215
                • 4,149 Posts
                Quote from: Dimmy at Oct 20, 2009, 08:15 AM

                does it have the event that eForm has?
                By ’event’, what do you mean? It has ’hooks’, which act as events - you can attach snippets to fire as hooks after the form is validated. You can also make snippets be validators, too: http://svn.modxcms.com/docs/display/ADDON/FormIt

                and do I mis the report chunk?
                Report chunk? Can you elaborate?
                  shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                  • 17883
                  • 1,039 Posts
                  And properties cant have properties on them, as in your example.

                  Hmmm, thought placeholders can have parameters as well:

                  All tags - no longer just Snippets - now accept properties, as well, that can be used. For example, let’s say we had a Chunk named ’Hello’ with the content:

                  http://svn.modxcms.com/docs/display/revolution/Tag+Syntax

                  But I`m fine with an errorTpl ;-)
                    • 28215
                    • 4,149 Posts
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 7455
                      • 2,204 Posts
                      Well when do the hooks activate?

                      like in eform I can say just before the mail is send out I can alter the output so I can add stuff to it maybe a time stamp or whatever I like or put the fields in the database etc etc. (http://wiki.modxcms.com/index.php/EForm#Events)

                      report is the chunk that is used to create the mail that is send out
                      using the names of the fields as placeholders, that way you can make a nice html email or at least order the values from the fields in a way you like.

                      eform also hase a chunk that can be used to send out to the one filling the form it will be differnd from the report chunk (the mail that is send to the owner of the site )

                      did you use eForm before? look at what eform can do and make formit at least have the same options.

                      Dimmy
                        follow me on twitter: @dimmy01