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
    See if my post from earlier today helps.
    https://forums.modx.com/thread/89391/errors-in-error-log-when-formit-is-on-a-resource#dis-post-491559

    There is alternate method of constructing the error handling.

    Quote from: johnnyp at Feb 28, 2014, 10:46 AM
    Error log:
     [2014-02-28 16:45:05] (ERROR @ /home/sites/domain.org.uk/public_html/core/cache/includes/elements/modsnippet/5.include.cache.php : 39) PHP warning: in_array() expects parameter 2 to be array, string given
    [2014-02-28 16:45:05] (ERROR @ /home/sites/domain.org.uk/public_html/core/cache/includes/elements/modsnippet/5.include.cache.php : 39) PHP warning: in_array() expects parameter 2 to be array, string given
    [2014-02-28 16:45:08] (ERROR @ /home/sites/domain.org.uk/public_html/core/cache/includes/elements/modsnippet/5.include.cache.php : 39) PHP warning: in_array() expects parameter 2 to be array, null given
    [2014-02-28 16:45:08] (ERROR @ /home/sites/domain.org.uk/public_html/core/cache/includes/elements/modsnippet/5.include.cache.php : 39) PHP warning: in_array() expects parameter 2 to be array, null given
    
    [ed. note: mmcgee last edited this post 12 years, 7 months ago.]
      • 46039
      • 76 Posts
      wow mmcgee, that does prevent the errors, however it doesn't fix the snippet call placeholder issue...

      I now only get this error:

      (ERROR @ /index.php) [FormIt] Please specify a recipient or recipients for the email.


      Which just states what I already know – the placeholders are returning nothing at all.

      Annoyingly I now have less to go on! But thanks so much for that fix.
        • 19872
        • 1,078 Posts
        Yes, but at least you get rid of the errors. From what I understand, errors can eventually bog down the system. In my case with one form, there would be 12 errors every time the page was loaded into a browser.

        Moving forward, though, yes... it's not pulling the information into the FormIt Call placeholder. I suspect because, in the normal process – and I'm no expert —the script processes the form contents, then prepares the email and sends it out. By being in a placeholder within the format call, perhaps there is a timing issue. The call is being made before the form has even been completed. For example, when that page loads, is it not starting with an empty selection?
          • 19872
          • 1,078 Posts
          Haven't read it yet, but maybe this will help.
          https://forums.modx.com/thread/47723/problem-with-placeholder-in-emailto

            • 19872
            • 1,078 Posts
            Oops... not really and answer. Sorry.

            I wonder if another chunk needs to be created... much like when you create the chunk for the contents of the email message. In that chunk is the placeholder for the result of the email address selection. Then, instead of a placeholder for additional email address in the &emailTo: put the chunk.
              • 19872
              • 1,078 Posts
              Oops... not really an answer. Sorry.

              I wonder if another chunk needs to be created... much like when you create the chunk for the contents of the email message. In that chunk is the placeholder for the result of the email address selection. Then, instead of a placeholder for additional email address in the &emailTo: put the chunk.
                • 46039
                • 76 Posts
                Didn't really help but gave me an idea – I explicitly set the emailTo and put the addessTo placeholder in the email TPL and it worked fine...

                I think you're right that this is something to do with order of execution.

                I'm starting to wonder whether the position of the snippet call on the page is the issue. But if I put the call after the form HTML it doesn't work at all... This is really odd.
                  • 19872
                  • 1,078 Posts
                  Vincent solution of a custom hook seems interesting, but that's beyond my skill at the moment, and I can't tell if it actually worked or not.
                  https://forums.modx.com/index.php/topic,54982.msg320652.html

                  I'm only somewhat knowledgeable because I'm been messing with my own form since early early this morning.
                    • 19872
                    • 1,078 Posts
                    If I am interpreting what you're attempting to do, it's not different than perhaps setting it up so that the user gets a copy of the form email too. Maybe that will help with searching. I know the forum is great. As well, sometimes I go to google, form my query, and select from the MODx search results there. As well other offsite tutorials and such may actually have the answer.
                      • 19872
                      • 1,078 Posts
                      Found what might be the answer you're looking for from Frogabog!

                      https://forums.modx.com/thread/81496/formit-confirmation-email

                      formItAutoResponder

                      and set the parameter with a new email chunk containing your placehoders just like in your regular email chunk.

                      &fiarTpl=`yourEmailChunkFIAR`