We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    Running MODx 2.4.2 and just updated to Formit 2.2.7

    Is there a debug hook that might help me to determine flaws in my form code?

    I have a rather lengthy form, which I am fairly confident was working fine. I am working with the FormItSaveForm hook, and successfully got the contents of a submitted form saved to the database. All good except that I have noticed some odd things that occurred as part of my testing.
    First, my message field is a required field. If I copy and paste text from a TextEdit, or InDesign, or another word program, the validation trips and indicates that my message field needs content. If I type directly into the field, the form submits successfully.
    However, what occurs after the first validation error is very odd. Values that I have typed into some of the other fields — apparently all that are located above my message field, pop the contents out to where error messages are displayed. If I don't retype the values into their respective fields again, those field value do no get sent to the database—thus appearing as though they were no value input. A few of these fields are country select menus. Thus, if United States were selected, rather than United States being shown as selected after a validation error, the words United States are visible in the error message area, where normally, it would state "Please Select Country".
    • That sounds a lot like an error in the actual HTML of the form, such as a missed closing tag somewhere. Have you run the page with the form through a validator, like the W3C validator? Even a view source may show errors.

      It might also be a problem with a Javascript validator, if you have one installed.
        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
        • 44580
        • 189 Posts
        If you are saying that the two issues are related, ie the second only happens after the first, then it may be that you are pasting in some special characters when you paste from InDesign etc. and this is screwing up the rest of the form. If not, then it is probably as Susan suggested.
          • 19872
          • 1,078 Posts
          Well. The form checks out OK at the W3C. No javascript validator is being used.
          Could have just been a fluke. I had a checkbox field that I believe I was incorrectly calling out in my hook. Once I got that corrected, the form works fine again, and everything also successfully posts to the database.

          Thanks very much for your responses.