Assistance Needed: Conditional Text Display in PDF Templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sapyantuk
    Senior Member
    • Oct 2020
    • 265

    Assistance Needed: Conditional Text Display in PDF Templates

    I have a field checklist with multiple options, such as "Compliance" and "Changes in Deadline." I'm trying to generate a PDF from PDF templates and need help with displaying text based on certain conditions.

    For example, I have a text statement: "The Company will comply with all necessary rules and regulations while providing the services." I want this text to be displayed in the PDF only if the "Compliance" option is enabled in the checklist. Otherwise, the text should be hidden.

    Could you please help me with how to check this condition and show or hide the text accordingly in the PDF template?
  • sapyantuk
    Senior Member
    • Oct 2020
    • 265

    #2
    Click image for larger version

Name:	image.png
Views:	105
Size:	29.8 KB
ID:	108672​checklist

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1605

      #3
      see here: https://forum.espocrm.com/forum/gene...ld-checkboxtag

      Comment

      • sapyantuk
        Senior Member
        • Oct 2020
        • 265

        #4
        shalmaxb

        {{#if checkboxTag fieldName option='Compliance'}}
        <li><b>Responsibility Post-Release:</b> Once the original documents and credentials (username and password) are released to the Customer, the Company does not hold any responsibility for future misuse or security breaches. The Customer is responsible for keeping these credentials confidential and secure. Any misuse or changes made by third parties will be the Customer's responsibility.</li>
        {{/if}}


        i tried this but it doesnt work

        Comment


        • shalmaxb
          shalmaxb commented
          Editing a comment
          where in your formula is written "fieldName" you have to put "cTermsAndCondition"
      • sapyantuk
        Senior Member
        • Oct 2020
        • 265

        #5
        {{#if checkboxTag cTermsAndCondition option='Compliance'}}
        <li><b>Responsibility Post-Release:</b> Once the original documents and credentials (username and password) are released to the Customer, the Company does not hold any responsibility for future misuse or security breaches. The Customer is responsible for keeping these credentials confidential and secure. Any misuse or changes made by third parties will be the Customer's responsibility.</li>
        {{/if}}​

        tried this still not working

        Comment

        • shalmaxb
          Senior Member
          • Mar 2015
          • 1605

          #6
          from the example in thread #3 I think, you do not need the if-Tag at all, put only every condition in a line of itself.

          Comment

          • sapyantuk
            Senior Member
            • Oct 2020
            • 265

            #7
            it will show like this checkbox at the end of text
            Click image for larger version

Name:	image.png
Views:	105
Size:	28.5 KB
ID:	108680

            Comment

            • sapyantuk
              Senior Member
              • Oct 2020
              • 265

              #8
              yuri please help

              Comment

              • item
                Active Community Member
                • Mar 2017
                • 1476

                #9
                Hi,
                can be a idea but your sample must so i think : i just move the {{/if}}
                I think it's more html issue because after checkbox, you have a <li> ... i think the checkboxTag must go after the <li> and before the <b>

                PHP Code:
                {{#if checkboxTag cTermsAndCondition option='Compliance'}}{{/if}}
                <li><b>Responsibility Post-Release:</b> Once the original documents and credentials (username and password) are released to the Customer, the Company does not hold any responsibility for future misuse or security breaches. The Customer is responsible for keeping these credentials confidential and secure. Any misuse or changes made by third parties will be the Customer's responsibility.</li>
                ​​ 
                
                If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

                Comment

                Working...