We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25586
    • 105 Posts
    Hi guys,

    I’m working on a website with a small orderform with sandwiches. I get the list of sandwiches with ditto and that is working great smiley, the only problem I have is the mailing part sad.

    When I receive the mail, it only contains the ditto snippit call, but not the list which it should output (same list as the order form).

    Do anyone of you know how this is possible?

    Thanks!

    Rogier
      • 25586
      • 105 Posts
      I noticed more people have the exact same problem. But there have never been a reply on this kind of topic. Could anyone explain why it is not possible to use a snippit or chunk call in the &report mail?

      Hope that someone has the answer!

      Rogier
        • 5340
        • 1,624 Posts
        Have you tried the eformOnBeforeMailSent event.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          eForm manages its own placeholders; it does not use the MODx placeholder array or merging. So it gets the specified chunk, merges its own placeholders, and then uses the chunk as the message of the mail. Since the chunk is never otherwise parsed, any other MODx tags will not be processes.

          If you want dynamic content in the email other than the eForm placeholders based on the form fields, you need to add these in a snippet with a function to evoke the eformOnBeforeMailSent event (also processed directly within the eForm snippet). Basically what you do here is add your own custom data to the $fields array that eForm uses to generate the mail message from the chunk. In this way you can add your own placeholders that are not from the form fields. Again, these placeholders are processed directly by eForm and have nothing to do with the MODx parser.
            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
            • 25586
            • 105 Posts
            So if I understand it correctly I have to use the eformOnBeforeMailSent handler to get the ditto output? I’m going to look in to it smiley Thanks!
              • 25132
              • 129 Posts
              Quote from: sottwell at Mar 23, 2010, 10:56 AM

              If you want dynamic content in the email other than the eForm placeholders based on the form fields, you need to add these in a snippet with a function to evoke the eformOnBeforeMailSent event (also processed directly within the eForm snippet). Basically what you do here is add your own custom data to the $fields array that eForm uses to generate the mail message from the chunk. In this way you can add your own placeholders that are not from the form fields. Again, these placeholders are processed directly by eForm and have nothing to do with the MODx parser.

              Susan,

              Would you be able to give an example for the ’snippet with a function to evoke the eFormOnBeforeMailSent event’? I am also trying to do this and have managed to use Ditto to generate a product list for an online order form but can’t get it to work in the email. I have no PHP skills but have been able to muddle through some PHP stuff before, so perhaps I’ll be able to get it to work from an example. Any help appreciated!
                • 16278
                • 928 Posts
                There are some useful examples in eform’s own documentation in the snippets/eform/docs folder (just open eform.htm in your browser).
                smiley KP
                  • 5340
                  • 1,624 Posts
                  Or the direct page to the events example: eform_example_events.htm
                    • 25132
                    • 129 Posts
                    Thanks guys, will go and have a look.
                      • 25586
                      • 105 Posts
                      Hi, I tried to use the eFormOnBeforeMailSent but I don’t know how to use it propperly. I would like to see an example on how to create a ditto call. Is that possible?

                      Thanks!

                      Rogier