Text calculation or Math calculation? (or neither)

By: Jordi Climent | Asked: 07/01/2024
ForumsCategory: General questionsText calculation or Math calculation? (or neither)
Jordi Climent asked 3 weeks ago

Hi!
I have a field with a numeric result. Depending on the number that appears, the user receives one message or another. For example: (We will call the numeric field, [1]). If [1] is less than 18.5, «message A»; if [1] is less than 25, «message B»; if [1] is less than 27, «message C».
If I put it as a text calculation, it doesn't work; and if I put it as a numeric calculation, it gives me an error. Example of calculation: ([1] < 18.5) ? (message A) : ([1] < 25) ? (message B) : ([1] < 27) ? (message C).

Please, what am I doing wrong?

Thank you!

2 Answers
Victor Font answered 3 weeks ago
Where are you trying to do the calculation? Are you trying to use conditionals with the email form action?
Jordi Climent replied 3 weeks ago

Hi, @Victor Font. I've created a hidden field for the calculation to be performed, with the intention of including it later in the email response. Thanks!

Bobby Clapp answered 1 week ago

Let us separate the calculated value and the message. Use the hidden field to simply take the calculated value. Wherever you want to display the message add multiple conditional shortcodes.

Example:
[if x greater_than="0" less_than="6"]Add your content here[/if x]
[if x greater_than="5" less_than="11"]Add your content here[/if x]

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right