We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29257
    • 18 Posts
    I have a problem with eForm report mail chunk. I need to check if some placeholder is empty to not write extra captions for empty strings. For example:
    <p>[+country:isnotempty:then=`<strong>Country: </strong>`][+country+]</p>

    But every placeholder I modify with columns ’:’ returns nothing.
    Is there any way to achieve this problem?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Do you have the PHx plugin intsalled? Eform does not include or use the phx class file by itself.
        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
        • 29257
        • 18 Posts
        Absolutely. PHx works great in all chunks but this chunk for email.
          • 33337
          • 3,975 Posts
          I think it will not work like this. Because chunk is being parsed by the eForm and not by the MODx document parser.

          But you can use eForm events to alter the data.

          I could be wrong.
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Ah. That’s because the mail report never actually exists in the document Object; it’s strictly internal to eForm and gets mailed off without MODx (or PHx) ever seeing it.

            You should be able to do something with the &eFormOnBeforeMailSent event. Perhaps in your report, just put the placeholder there, and in the event function if it exists in the $fields array replace the bare value with the entire line you want.
              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