We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I’m glad you got it sorted. smiley

    I’ve updated the documentation so hopefully it’s clearer now.
      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
      • 7455
      • 2,204 Posts
      The :required parameter is not working on file input fields
        follow me on twitter: @dimmy01
        • 7455
        • 2,204 Posts
        Is it posible to use fieldnames (placeholders) in the snippetcall?
        like emailFrom = `[[+email]]`
        emailFromName = `[[+yourName]]`

        I tryed this but is does not seem to work.

        this is essential for lots of forms we make
          follow me on twitter: @dimmy01
          • 28215
          • 4,149 Posts
          Quote from: Dimmy at Apr 28, 2010, 05:51 AM

          The :required parameter is not working on file input fields

          Can you add that as a bug: http://svn.modxcms.com/jira/browse/ADDON
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 28215
            • 4,149 Posts
            Quote from: Dimmy at Apr 28, 2010, 05:59 AM

            Is it posible to use fieldnames (placeholders) in the snippetcall?
            like emailFrom = `[[+email]]`
            emailFromName = `[[+yourName]]`
            I tryed this but is does not seem to work.
            this is essential for lots of forms we make

            In what snippet call? FormIt’s? Yep, you can. You shouldn’t have a space between the name and the parameter though. Do this:

            &emailFromName=`[[+yourName]]`
            
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 16494
              • 4 Posts
              Interesting behavior: if the math question equals to zero (for example 4 - 4 like I had) and the correct answer is entered (0), FormIt thinks that nothing is entered (0 == false == ’’) and returns missing required field error. It seems there is a ’==’ instead of ’===’ somewhere...


              And seems FormIt doesn’t support preselected (prechecked) checkboxes: there is no way to make a checkbox checked by default using FormIt (without using external tricks).
                • 3749
                • 24,544 Posts
                You should be able to make a checkbox checked by adding a [[+checked]] placeholder in the form:

                <input type="checkbox" [[+checked] name="whatever"  ... etc.>


                Then put a snippet above the form that does this, but only when the form first loads:

                $modx->setPlaceholder('checked', 'checked="checked"');


                The FormIt math hook should probably make sure the answer isn’t 0. Could you file that as a bug?

                  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
                  • 16494
                  • 4 Posts
                  Quote from: BobRay at Mar 10, 2011, 09:55 PM

                  You should be able to make a checkbox checked by adding a [[+checked]] placeholder in the form:

                  <input type="checkbox" [[+checked] name="whatever"  ... etc.>


                  Then put a snippet above the form that does this, but only when the form first loads:

                  $modx->setPlaceholder('checked', 'checked="checked"');
                  Well, that is almost exactly that I did. But it might be better if FormIt will support checkboxex checked by default itself. For example with [[!+fi.checkboxname:FormItIsChecked=`Yes||default`]] syntax or something like this.

                  And moreover... PHP doesn’t send any value if checkbox is unchecked. If I have:

                  <input type="checkbox" id="whatever" name="whatever" value="Yes" [[!+fi.whatever:FormItIsChecked=`Yes`]] />


                  I will receive ’Yes’ in [[+whatever]] in my email template if checkbox was checked and nothing if it was not. But I want to have ’No’ in [[+whatever]] if checkbox was unchecked. smiley

                  The FormIt math hook should probably make sure the answer isn’t 0. Could you file that as a bug?
                  Well, the answer is 0 is not a problem, the problem is 0 equals null or empty string somewhere in FormIt math. And I think it’s because of using functions without checking variable type like == and != instead of === and !== when input value is checking.
                    • 3749
                    • 24,544 Posts
                    I think you can get a value for an unchecked checkbox if you have a hidden input for it.

                    http://rtfm.modx.com/display/ADDON/FormIt.Handling+Selects,+Checkboxes+and+Radios
                      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
                      • 16494
                      • 4 Posts
                      Quote from: BobRay at Mar 11, 2011, 11:48 PM
                      I think you can get a value for an unchecked checkbox if you have a hidden input for it.
                      Thanks, cap! smiley This is the only way now. But looks a little bit quirky.