Conditional Display

Forminator Forms
27 January, 2025 15:59:41
recuniforms
Topics: 8
Messages: 47
I'm trying to display {calculation-18} when {calculation-4} is less than or equal to 999.5; and {calculation-4} when it's greater than 999.5.

[e2pdf-if][e2pdf-if-condition]{calculation-4}[<=]999.5[/e2pdf-if-condition][e2pdf-if-do]
<b>${calculation-18}</b>[/e2pdf-if-do][e2pdf-if-else]<b>${calculation-4}</b>[/e2pdf-if-else][/e2pdf-if]

Right now, it's always displaying the else condition. It works as expected when I replace {calculation-4} with 1000 in the condition. Can you see anything wrong with what I have?

Also, [<=] is replaced by [&lt;=], but I don't understand why ... ? It's not replaced in another snippet of code I have elsewhere.
27 January, 2025 16:13:54
recuniforms
Topics: 8
Messages: 47
My feeling is that {calculation-4} is displaying as a string instead of a number ... ?
28 January, 2025 00:05:08
E2Pdf
Support
Topics: 7
Messages: 3413
Hello,

The conversion to "<" can occur if the "Disable WYSIWYG Editor" option is not checked. Please ensure it is checked to prevent this conversion.

Regarding the condition, unfortunately, we are unable to replicate the issue on our end. Is your value being saved correctly in the Entry? If you use {calculation-4}, what value would be printed?
We would really appreciate your feedback at WordPress.org!
28 January, 2025 04:49:32
recuniforms
Topics: 8
Messages: 47
I created a 'test form' with this code:

<p>[e2pdf-if][e2pdf-if-condition]{calculation-4}[<=]999.5[/e2pdf-if-condition][e2pdf-if-do]
<b>${calculation-18}</b>[/e2pdf-if-do][e2pdf-if-else]<b>${calculation-4}</b>[/e2pdf-if-else][/e2pdf-if]</p>
<br>
<p>${calculation-4}</p>

I've attached the output.

In this example, {calculation-4} = 23,990.00, which is not [<=] 999.5 so the else condition should be triggered and {calculation-4} should be displayed. As you can see in the attachment, {calculation-18} is being displayed, meaning that the if condition is being triggered.

[In my original question, I stated it was always displaying the else value. However, I meant the opposite: it is always displaying the *if* value.]
28 January, 2025 05:14:08
E2Pdf
Support
Topics: 7
Messages: 3413
Thank you for the clarification. The issue is caused by the number format you are using. You need to remove the ','.

Could you please try to use the modified shortcode: https://codefile.io/f/vA2pwfkcqn


We would really appreciate your feedback at WordPress.org!
28 January, 2025 05:17:28
recuniforms
Topics: 8
Messages: 47
<p>[e2pdf-if][e2pdf-if-condition]{calculation-4}[>=]999.5[/e2pdf-if-condition][e2pdf-if-do]
<b>${calculation-18}</b>[/e2pdf-if-do][e2pdf-if-else]<b>${calculation-4}</b>[/e2pdf-if-else][/e2pdf-if]</p>

I switch t he [<=] to [>=] and now it's always displaying the else value (I've used datasets where {calcuation-4} is greater than 999.5 as in the example above and also datasets where {calculation-4} is less than 999.5. Both produce the same output. It's always reading it as a number less than 999.5.
28 January, 2025 05:19:28
recuniforms
Topics: 8
Messages: 47
That worked! Thank you!