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

    I'm trying to use an output filter to show a chunk only for one page. Here is my code:

    [[*id:is=`2`:then=`[[$lunch-newsletter]]`:else=``]]

    [[$lunch-newsletter]] looks like this:

    [[!FormIt?
    &hooks=`spam,FormSave,email,redirect,FormItAutoResponder,hook.RampartFormIt`
    &validate=`email:email:required`
    &emailTpl=`lunch-newsletter-report`
    &emailTo=`[[++form_emails]]`
    &emailSubject=`[[++site_name]] - Lunch and Learn Newsletter Form Submission`
    &fsFormTopic=`Lunch and Learn Newsletter`
    &submitVar=`lunchVar`
    &redirectTo=`53`
    &fiarTpl=`lunch-newsletter-auto-response`
    &fiarReplyTo=`[[++form_emails]]`
    &fiarFrom=`[[++form_emails]]`
    &fiarSubject=`[[++site_name]] - Lunch and Learn Newsletter Form Submission`
    &placeholderPrefix=`filunch.`
    ]]
    <form id="lunch-newsletter" action="[[~[[*id]]]]" method="post" class="clearfix">
    <input type="hidden" name="nospam:blank" value="" />
    <h4>Lunch and Learn Sign Up</h4>
    <fieldset>
    [[!+filunch.error.rampart]]
    [[!+filunch.validation_error_message]]
    <label for="l-email">Email <span class="req">*</span></label>
    <span class="error">[[!+filunch.error.email]]</span>
    <input id="l-email" type="email" placeholder="Type in your e-mail address" name="email" class="required" />
    <input type="hidden" value="lunchVar" id="lunchVar" name="lunchVar" class="lunchVar" />
    <input type="submit" class="submit" value="Submit" />

    </fieldset>

    </form>
    <!-- /newsletter -->



    The weird part about this is when I place a different chunk that doesn't have a form in it, the chunk shows up on that one page. Any suggestions?

    Thanks!

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 36613
      • 328 Posts
      Have you tried doing an If?

      [[!If?
         &subject=`[[*id]]`
         &operator=`EQ`
         &operand=`2`
         &then=`[[$lunch-newsletter]]`
      ]]
      • discuss.answer
        • 25803 ☆ A M B ☆
        • 721 Posts
        It worked for me right away with MODX 2.2.8 though I prefer this method instead:

        [[[[*id:is=`2`:then=`$lunch-newsletter`:else=``]]]]


        The why is in this blog entry.

        Did you clear cache, flush permissions, and flush all sessions? Use CacheClear? Try different browsers?
          • 44095
          • 10 Posts
          Both suggestions worked! Thanks guys!