Help with conditionals and tables when try to print to pdf

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • skynext280
    replied
    Hey all again, This works for me, as Yuri and rabii said, I must put the <td> tags and inside the conditional

    <td>
    {{#ifEqual closed "yes"}}
    oke is yes
    {{else}}
    oke is no
    {{/ifEqual }}
    </td>

    thx u all!

    Leave a comment:


  • rabii
    replied
    try this as Yuri mentioned

    PHP Code:
    <table>
    <tbody>
    <tr>
    <td>
    {{#if closed "yes"}}
        oke is yes
    {{else}}
    oke is no
    {{/if}}
    </td>
    </tr>
    </tbody>
    </table>

    Leave a comment:


  • yuri
    replied
    Moving conditional part inside the a TD tag wlll work. The requirement is a code being a valid HTML, otherwise the contenteditable will modify the code to be valid HTML

    Leave a comment:


  • shalmaxb
    replied
    the editor puts the condition to the top, but this does not matter. I guess your field "closed" is a bool? Then you must write {{#if closed 'true'}}. The values of bool are true or false.

    Leave a comment:


  • Help with conditionals and tables when try to print to pdf

    Hey all, I think I'm doing something wrong, because I'm trying to use the conditionals inside the html tags when I make a pdf template, that is, I have this code


    <table>
    <tbody>
    <tr>
    <td>one</td>
    <td>two</td>
    </tr>
    </tbody>
    </table>​​​


    And I check the value of a field on my entity called {{closed}} posible values "yes", "no".

    The problem is, I try to make a if inside table like

    <table>
    <tbody>
    <tr>
    {{#if closed "yes"}}
    <td>oke is yes</td>
    {{else}}
    <td>oke is no</td>
    </tr>
    </tbody>
    </table>​​​


    when I saved and try to check printing got wrong, so I open the template again and my code is like this

    {#if closed "yes"}}

    {{else}}


    <table>
    <tbody>
    <tr>
    <td>oke is yes</td>
    <td>oke is no</td>
    </tr>
    </tbody>
    </table>​​​


    The questions is, How can I put conditionals inside tables, also I try on other entity something like this



    <table style="width: 100%;">
    <tbody>
    <tr iterate="{{contacts}}">
    <td>{{name}}</td>
    <td>{{assignedUserName}}</td>
    </tr>
    <tr>
    {{#if closed "yes"}}
    <td>oke is yes</td>
    {{else}}
    <td>oke is no</td>
    </tr>
    </tbody>
    </table>

    and get the same result


    {{#if closed "yes"}}

    {{else}}

    <table style="width: 100%;">
    <tbody>
    <tr iterate="{{contacts}}">
    <td>{{name}}</td>
    <td>{{assignedUserName}}</td>
    </tr>
    <tr>

    <td>oke is yes</td>
    <td>oke is no</td>
    </tr>
    </tbody>
    </table>


    thx for ur help
Working...