Conditional: If the value of field A < value of field B

By: Peter Nicholson | Asked: 01/10/2023
ForumsCategory: General questionsConditional: If the value of field A < value of field B
Peter Nicholson asked 1 year ago
As the title suggests, I am trying to compare to fields to one another based on their values in my view. Field A = a number between 1 - 6 (based on user selection). Field B = a number between 1 - 6 (based on user selection). Basically, I am creating a scoreboard, and the order is based on the lowest score out of multiple number fields. I need to add a class to whichever field has the lowest value. Hope that makes sense! Much appreciated legends.
Bobby Clapp replied 1 year ago

Are you wanting to highlight a field (CSS code via class) depending on the value comparison?

Peter Nicholson replied 1 year ago

That is exactly what I am trying to achieve 😉

Bobby Clapp replied 1 year ago

Other than changing it from hide show to simply change the css class, this should work as a good example:

https://formidableforms.com/knowledgebase/javascript-examples/#kb-conditionally-hideshow-a-field

Peter Nicholson replied 1 year ago

Ah, I should have mentioned that I will have more than 2 values to compare, but that was my error. If there is nothing built in for this comparison, I can get the values using Javascript and do some if else magic.

Thanks

Bobby Clapp replied 1 year ago

You will need the magic. 🙂

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