We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Actually what happens is the eForm silently fails (that’s what the return false in the snippet’s function does), so the page with the empty form is reloaded; it’s just that (presumably) nobody is there to see it.

    And that’s not my idea nor my code, I shamelessly ripped it off from bobray’s SPForm.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 26931
      • 2,314 Posts
      Actually what happens is the eForm silently fails (that’s what the return false in the snippet’s function does), so the page with the empty form is reloaded; it’s just that (presumably) nobody is there to see it.
      thanks for clarification Susan
        • 26931
        • 2,314 Posts
        display: none;

        The only downside to this approach is that Google may penalize you for having hidden content. If you use the method Sottwell describes above in your CSS instead, the field will be invisible to users but Google’s bots (and spambots programmed to ignore "display:none" content)will still "see" it.

        what if i use <meta name="robots" content="noindex,nofollow" /> on that page?
        with Susan’s css method the field could still accidentally be filled if someone uses the tab key to navigate the form

        what do you guys think?

        thanks, j
          • 38733
          • 22 Posts
          Tabbing does seem to go to the hidden field(s), but if you then start typing in say Firefox, it tries to do a quick find instead, as if the focus is not on a hidden field.
          • In the form, give that field some ridiculous tabindex value, and make sure the other fields have sane tabindex values.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 38733
              • 22 Posts
              Or just put the hidden field(s) after the form submit/reset buttons but before </form>: works for me.
                • 3749
                • 24,544 Posts
                On reminder about hidden spam fields -- They will occasionally be filled in for regular users when they have password managers like Roboform or LastPass or have browser password filling turned on. The user will fail the spam test and won't know why.

                I also question whether they will fool any intelligent bot these days as it's pretty easy to identify a hidden or off-screen form field in code.


                ------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using.
                MODX info for everyone: http://bobsguides.com/modx.html
                  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
                  • 5340
                  • 1,624 Posts
                  Quote from: BobRay at May 12, 2012, 01:31 AM
                  On reminder about hidden spam fields -- They will occasionally be filled in for regular users when they have password managers like Roboform or LastPass or have browser password filling turned on. The user will fail the spam test and won't know why.

                  Hi Bob,
                  I don't think the above can happen for fields named like xxxyyyzzz or fft556ertwyi?
                  I could be wrong.

                    • 3749
                    • 24,544 Posts
                    It's a tradeoff. A bot might not fill those in either
                      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
                      • 14214
                      • 299 Posts
                      Anyone have success implementing something similar in Revolution for FormIt. We are having a horrible time with some spammers recently on a couple forms and my efforts seem as if they are not working using the :empty in validation.