We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31354
    • 24 Posts
    I've got a site with 19 different forms some with lots of fields and data.

    To go along with these forms I've got a success page using the redirect, along with 13 different email templates that send the data from these forms.

    Everything has been working fine for months, even years and now all the sudden I am having issues with the email templates showing place holders when it should not.

    This seems to coordinate with and update to MODX 2.4.3pl, other than that, I have not made any recent changes to the forms or email templates.

    I checked today and there was an update to FormIt, I updated the install, but that did not seem to help.

    I'm using basic HTML for the template. i.e.:
    <p>
    [[+wedding_renewal_date:notempty=`[[+wedding_renewal_date]]
    `]]
    [[+package:notempty=`[[+package]]
    `]]
    [[+wedding_location:notempty=`[[+wedding_location]]
    `]]
    [[+hotel:notempty=`[[+hotel]]
    `]]
    [[+contact_name:notempty=`[[+contact_name]]
    `]]
    [[+bridegroom_name:notempty=`[[+bridegroom_name]]
    `]]
    [[+fiances_name:notempty=`[[+fiances_name]]
    `]]
    [[+day_phone:notempty=`[[+day_phone]]
    `]]
    [[+evening_phone:notempty=`[[+evening_phone]]
    `]]
    [[+cell:notempty=`[[+cell]]
    `]]
    [[+email:notempty=`[[+email]]
    `]]
    [[+address:notempty=`[[+address]]
    `]]
    [[+city:notempty=`[[+city]]
    `]]
    [[+state:notempty=`[[+state]]
    `]]
    [[+zip:notempty=`[[+zip]]`]]
    </p>

    The problem I am experiencing is that some of these statements work fine.
    Others that DO NOT have any data still print the place holders, and still others that DO have data print the placeholder and then the data after them.

    I can't seem to figure any reason why it is not working properly, or consistently.

    Any thoughts, or has anyone else experienced anything similar?
      • 3749
      • 24,544 Posts
      I'm not sure I understand your use of :notempty. If you use just the tags without the output modifier, a tag for an empty TV will show nothing, which seems like what you want. It would be faster and might be a lot more reliable.
        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
        • 39827
        • 42 Posts
        Hello,

        I allways use this method to check if its empty.

        [[+placeholder:gt=`1`:then=`[[+placeholder]]`]]

        or

        [[[[+placeholder:gt=`1`:then=`+placeholder`]]]]

        Hope it helps
          • 31354
          • 24 Posts
          Quote from: BobRay at Mar 15, 2016, 07:51 AM
          I'm not sure I understand your use of :notempty. If you use just the tags without the output modifier, a tag for an empty TV will show nothing, which seems like what you want. It would be faster and might be a lot more reliable.

          Well, the problem I had with just having the place holder was formatting the email, since I have the line breaks
          <br>
          in the HTML which seem to have been deleted in my original post, there were big gaps of space when data was missing.

          Also, I have been sharing email templates between forms and where there was no form data, that information was simply hidden from the email. Now, it seems that if there is a form placeholder where there is no corresponding form field/data, that it is printing the whole place holder instead of hiding it.

          Here's the code once again in the code field:
          <p>
          [[+wedding_renewal_date:notempty=`[[+wedding_renewal_date]]<br>`]]
          [[+package:notempty=`[[+package]]<br>`]]
          [[+wedding_location:notempty=`[[+wedding_location]]<br>`]]
          [[+hotel:notempty=`[[+hotel]]<br>`]]
          [[+contact_name:notempty=`[[+contact_name]]<br>`]]
          [[+bridegroom_name:notempty=`[[+bridegroom_name]]<br>`]]
          [[+fiances_name:notempty=`[[+fiances_name]]<br>`]]
          [[+day_phone:notempty=`[[+day_phone]]<br>`]]
          [[+evening_phone:notempty=`[[+evening_phone]]<br>`]]
          [[+cell:notempty=`[[+cell]]<br>`]]
          [[+email:notempty=`[[+email]]<br>`]]
          [[+address:notempty=`[[+address]]<br>`]]
          [[+city:notempty=`[[+city]]<br>`]]
          [[+state:notempty=`[[+state]]<br>`]]
          [[+zip:notempty=`[[+zip]]`]]
          </p>
          
          • The latest FormIt uses something very similar for a default email template if none is specified in the snippet properties. You might want to try that and see what it does; just remove the &tpl property.
              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
              • 31354
              • 24 Posts
              Quote from: sottwell at Mar 15, 2016, 09:49 AM
              The latest FormIt uses something very similar for a default email template if none is specified in the snippet properties. You might want to try that and see what it does; just remove the &tpl property.

              Thank you!!!, I'll experiment with that in another install, for now, since this template has header and footer graphics and quite a bit of formatting, looks like I'll just have to create separate templates for each form in this one.