根据无线电元素的选定选项打印表
我有一个带有三个选项的无线电元件(正常,时间敏感,并且保持拾音)。每当用户单击一个选项时,该选项的唯一表元素(供用户填写信息)会自动弹出。最后,我想将所有提交的数据打印到PDF附件。
当我为其编写树枝代码时,我被困在要打印属于所选选项的表的部分中,
{# choose_your_shipping_option: radio's key #}
{# Normal: option text #}
{% if webform_token('[webform_submission:values:choose_your_shipping_option]') == "Normal" %}
<table>
<tr>
<th>Shipping Address:</th>
<th>Acct #</th>
</tr>
<tr>
<td rowspan="3">[webform_submission:values:shipping_address]</td>
<td>[webform_submission:values:id_num]</td>
</tr>
<tr>
<th>Phone</th>
</tr>
<tr>
<td>
[webform_submission:values:phone]
</td>
</tr>
</table>
{% elseif webform_token('[webform_submission:values:choose_your_shipping_option]') == "Time Sensitive" %}
<table>
<tr>
<th>Delivery Date</th>
<td>[webform_submission:values:time_sensitive_01_delivery_date]</td>
<th>Must Have Street Address (No PO Box)</th>
</tr>
<tr>
<th colspan="2">Shipping Address:</th>
<th>Acct #</th>
</tr>
<tr>
<td colspan="2" rowspan="3" style="text-align: center;">[webform_submission:values:shipping_address_2]</td>
<td>[webform_submission:values:id_num]</td>
</tr>
<tr>
<th>Phone</th>
</tr>
<tr>
<td>
[webform_submission:values:phone_2]
</td>
</tr>
</table>
{% elseif webform_token('[webform_submission:values:choose_your_shipping_option]') == "Hold For Pick-Up" %}
<table>
<tr>
<th>Will be picked up by</th>
<th>Pick-up Date:</th>
</tr>
<tr>
<td>[webform_submission:values:pick_up_01_picked_up_by]</td>
<td>[webform_submission:values:pick_up_01_pick_up_date]</td>
</tr>
<tr>
<th>Pick-up Location</th>
<th>Pick-up Time</th>
</tr>
<tr>
<td>[webform_submission:values:location]</td>
<td>[webform_submission:values:time]</td>
</tr>
</table>
{% endif %}
当我使用 webform_token 时,它将破坏PDF模板。是否有正确的方法仅打印用户填写的方法?
I have a radio element with three options (Normal, Time Sensitive, and Hold For Pick-Up). Every time an user clicks an option, an unique table element for the option (for user to fill information) will pop up automatically. Finally, I would like to print all the submitted data to PDF attachment.
As I write the twig code for it, I am stuck in the part where I want to print the table that belongs to the selected option
{# choose_your_shipping_option: radio's key #}
{# Normal: option text #}
{% if webform_token('[webform_submission:values:choose_your_shipping_option]') == "Normal" %}
<table>
<tr>
<th>Shipping Address:</th>
<th>Acct #</th>
</tr>
<tr>
<td rowspan="3">[webform_submission:values:shipping_address]</td>
<td>[webform_submission:values:id_num]</td>
</tr>
<tr>
<th>Phone</th>
</tr>
<tr>
<td>
[webform_submission:values:phone]
</td>
</tr>
</table>
{% elseif webform_token('[webform_submission:values:choose_your_shipping_option]') == "Time Sensitive" %}
<table>
<tr>
<th>Delivery Date</th>
<td>[webform_submission:values:time_sensitive_01_delivery_date]</td>
<th>Must Have Street Address (No PO Box)</th>
</tr>
<tr>
<th colspan="2">Shipping Address:</th>
<th>Acct #</th>
</tr>
<tr>
<td colspan="2" rowspan="3" style="text-align: center;">[webform_submission:values:shipping_address_2]</td>
<td>[webform_submission:values:id_num]</td>
</tr>
<tr>
<th>Phone</th>
</tr>
<tr>
<td>
[webform_submission:values:phone_2]
</td>
</tr>
</table>
{% elseif webform_token('[webform_submission:values:choose_your_shipping_option]') == "Hold For Pick-Up" %}
<table>
<tr>
<th>Will be picked up by</th>
<th>Pick-up Date:</th>
</tr>
<tr>
<td>[webform_submission:values:pick_up_01_picked_up_by]</td>
<td>[webform_submission:values:pick_up_01_pick_up_date]</td>
</tr>
<tr>
<th>Pick-up Location</th>
<th>Pick-up Time</th>
</tr>
<tr>
<td>[webform_submission:values:location]</td>
<td>[webform_submission:values:time]</td>
</tr>
</table>
{% endif %}
It would ruin the pdf template when I use webform_token. Is there a correct way to print only the one that's filled by the user?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论