Conditional Diplay

Forminator Forms
20 January, 2025 19:00:10
recuniforms
Topics: 4
Messages: 21
I have two tables in my PDF and, for each, I would like to display a column (<td class="travel" for both) only if {select-10} is "Travel Set". Google searches provide script solutions, but I'm not sure I can apply those ... ? Thanks in advance!
20 January, 2025 23:48:55
E2Pdf
Support
Topics: 7
Messages: 3377
Hello,

You should use the [e2pdf-if] shortcode: https://codefile.io/f/eowEIQ7HQa

IMPORTANT: Make sure to enable the "Disable WYSIWYG Editor" option in the HTML field to prevent any reformatting issues.
We would really appreciate your feedback at WordPress.org!
21 January, 2025 05:24:16
recuniforms
Topics: 4
Messages: 21
Thank you! It worked perfectly for the first index (page 1), but it's still displaying <td class="travel"> for the second index (page 2).

Also, is this something I have to add to each <td> or can I add it once and have it apply to all of class="travel".
21 January, 2025 05:52:55
E2Pdf
Support
Topics: 7
Messages: 3377
It should work on the second page the same way as it does on the first.

Could you please attach some screenshots showing how the values are set on the first and second pages?

If you need class="travel" to be added to separate pages or elements, then yes, it should be added to each required "td".
We would really appreciate your feedback at WordPress.org!
21 January, 2025 15:39:26
recuniforms
Topics: 4
Messages: 21
Page 2 is generated by a foreach loop ...

{foreach:group-3}
<div style="page-break-before: always;">

... so the code is the same. The if statement works well when the index is 1. It is not working when the index is 2.

Re: the class, I have it added to the td. But I'm wondering if I have to add the if statement to each td or if I can apply the if statement to entire class at once.
21 January, 2025 16:46:07
recuniforms
Topics: 4
Messages: 21
I may have discovered the problem.
21 January, 2025 16:55:13
recuniforms
Topics: 4
Messages: 21
I believe the problem is that it isn't handling the nested if statement. Here is what I'm trying to do:

[e2pdf-if] [e2pdf-if-condition]{select-10}[==]Travel Set[/e2pdf-if-condition][e2pdf-if-do]<td width="50" class="travel">[e2pdf-if][e2pdf-if-condition]{select-8}[in_array]a:31:{i:0;s:4:"6001";i:1;s:4:"6006";i:2;s:4:"6007";i:3;s:4:"6010";i:4;s:4:"6011";i:5;s:4:"6012";i:6;s:4:"L025";i:7;s:4:"L036";i:8;s:4:"L040";i:9;s:4:"L043";i:10;s:4:"L044";i:11;s:4:"L045";i:12;s:4:"L049";i:13;s:4:"L051";i:14;s:4:"L052";i:15;s:4:"L056";i:16;s:4:"L059";i:17;s:4:"L060";i:18;s:4:"L062";i:19;s:4:"L066";i:20;s:4:"L067";i:21;s:5:"L1023";i:22;s:5:"L1024";i:23;s:4:"Z108";i:24;s:4:"Z109";i:25;s:4:"Z110";i:26;s:4:"Z111";i:27;s:4:"Z112";i:28;s:4:"Z114";i:29;s:4:"Z115";i:30;s:4:"Z116";}[/e2pdf-if-condition][e2pdf-if-do][e2pdf-format-output search="Youth XS|||Youth S|||Youth M|||Youth L|||Youth XL|||Adult S|||Adult M|||Adult L|||Adult XL|||Adult 2XL" replace="4XS|||3XS|||2XS|||XS|||S|||L|||2XL|||3XL|||4XL|||5XL"]{select-11}[/e2pdf-format-output][/e2pdf-if-do][e2pdf-if-else][e2pdf-format-output search="Youth XS|||Youth S|||Youth M|||Youth L|||Youth XL|||Adult S|||Adult M|||Adult L|||Adult XL|||Adult 2XL" replace="ERROR|||5XS|||4XS|||3XS|||2XS|||S|||L|||XL|||2XL|||ERROR"]{select-11}[/e2pdf-format-output][/e2pdf-if-else][/e2pdf-if]</td>[/e2pdf-if-do]
[/e2pdf-if]

It's outputting code in the PDF.
21 January, 2025 23:08:00
E2Pdf
Support
Topics: 7
Messages: 3377
Unfortunately, yes, nested [e2pdf-if] shortcodes aren't supported, so the shortcode needs to be rebuilt.

Could you please clarify the behavior? Do you need to display:
1. The entire block only when {select-10} is set to "Travel Set" and {select-8} is part of an array?

Or

2. Should it just be a "td" element with a class "travel" when {select-10} is set to "Travel Set," while {select-8} is always displayed but in "td" without class "travel"?
We would really appreciate your feedback at WordPress.org!