Conditional Display

Forminator Forms
January 27, 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.
January 27, 2025 16:13:54
recuniforms
Topics: 8
Messages: 47
My feeling is that {calculation-4} is displaying as a string instead of a number ... ?
January 28, 2025 00:05:08
E2Pdf
Topics: 7
Messages: 3617
Support
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!
January 28, 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.]
January 28, 2025 05:14:08
E2Pdf
Topics: 7
Messages: 3617
Support
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!
January 28, 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.
January 28, 2025 05:19:28
recuniforms
Topics: 8
Messages: 47
That worked! Thank you!
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.