1 year ago

#277284

test-img

edward55

Why is my email body not printing submitted data into a table?

I am trying to print the submission data to PDF and email body of email handler when I submit. I am literally using the the twig code for both. The submission is successfully printed in PDF field as I wanted, but not in email body. Here is the whole code of my email handler. I didn't have this problem until I changed the layout. Could anyone tell me what is going wrong?

[webform_submission:token-view-url]
<style>
  th {
      background-color: rgba(143, 220, 242, 0.67);
      border: 1px solid rgba(5, 138, 222, 0.67);
      border-left: 1px solid rgba(5, 138, 222, 0.67);
      border-bottom: 1px solid rgba(5, 138, 222, 0.67);
      color: #000000;
      text-align: center;
      font-weight: bold;
      vertical-align: middle;
      padding: .75em .5em;

  }

  td {
      text-align: right;
      border: 1px solid rgba(5, 138, 222, 0.67);
      vertical-align: middle;
      padding: .75em .5em;
  }

  table {
      border-collapse: collapse;
      border: 1px solid rgba(5, 138, 222, 0.67);
      empty-cells: show;
      margin: 1%;
      width: 100%;
      table-layout: auto;
  }
  #exception {
      background-color: rgba(143, 220, 242, 0.67);
      border: 1px solid rgba(5, 138, 222, 0.67);
      border-left: 1px solid rgba(5, 138, 222, 0.67);
      border-bottom: 1px solid rgba(5, 138, 222, 0.67);
      color: #000000;
      text-align: center;
      font-weight: bold;
  }
</style>

<table>
        <tr>
            <th colspan="2">
                ACCOUNT HOLDER INFORMATION:
            </th>
            <th colspan="2">
                BANK INFORMATION:
            </th>
        </tr>
        <tr>
            <td id="exception">Name</td>
            <td>[webform_submission:values:account_holder_information__01_name]</td>
            <td id="exception">Bank Name</td>
            <td>[webform_submission:values:bank_information__01_bank_name]</td>
        </tr>
        <tr>
            <td id="exception">Address</td>
            <td>[webform_submission:values:account_holder_information__01_address]</td>
            <td id="exception">Branch</td>
            <td>[webform_submission:values:branch]</td>
        </tr>
        <tr>
            <td id="exception">Account #</td>
            <td>[webform_submission:values:account_holder_information__01_account_]</td>
            <td id="exception">Routing #</td>
            <td>[webform_submission:values:routing_number]</td>
        </tr>
        <tr>
            <td id="exception">Email</td>
            <td>[webform_submission:values:account_holder_information__01_email]</td>
            <td style="text-align: center;">[webform_submission:values:notify_by_email_when_transfer_complete]</td>
            <td id="exception">Notify by Email When Transfer Complete</td>
        </tr>
</table>
<br>

<table>
    <tr>
        <th id="exception">REQUEST BY</th>
        <th id="exception">TODAY'S DATE</th>
        <th id="exception" colspan="2">DUE DATE</th>
    </tr>
    <tr>
        <td>[webform_submission:values:requested_by_01_requested_by_02]</td>
        <td>[webform_submission:values:requested_by_01_today_s_date]</td>
        <td colspan="2">[webform_submission:values:requested_by_01_due_date]</td>
    </tr>
    <tr>
        <td id="exception">REQUEST CURRENCY</td>
        <td>[webform_submission:values:currency_rate_01_request_currency]</td>
        <td id="exception">EXCHANGE RATE</td>
        <td>[webform_submission:values:currency_rate_01_exchange_rate]</td>
    </tr>
</table>
<br>

<table>
    <tr>
      <th id="exception">QTY</th>
      <th id="exception">PURPOSE</th>
      <th id="exception">ACCT#</th>
      <th id="exception">DEPT#</th>
      <th id="exception">PROJ#</th>
      <th id="exception">FUNC#</th>
      <th id="exception">TOTAL PRICE</th>
    </tr>

    {% for item in data.spending %}
        <tr>
            <td>{{item.qty}}</td>
            <td>{{item.purpose}}</td>
            <td>{{item.acct_num}}</td>
            <td>{{item.dept_num}}</td>
            <td>{{item.proj_num}}</td>
            <td>{{item.func_num}}</td>
            <td>{{'$ ' ~ item.total}}</td>
        </tr>
    {% endfor %}
    <tr>
        <td id="exception">SUBTOTAL</td>
        <td colspan="6">[webform_submission:values:balance_due_01_balance_due_sub_total]</td>
    </tr>
</table>

<table>
    <tr>
      <th id="exception">AUTHORIZED PURCHASER</th>
      <th id="exception">DIRECTOR APPROVAL</th>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>
    <tr>
      <th id="exception">ACCT APPROVAL</th>
      <th id="exception">EXEC APPROVAL</th>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>

html

css

twig

drupal-webform

drupal-9

0 Answers

Your Answer

Accepted video resources