calculated count field based on non-empty text fields?

By: Jeff Wright | Asked: 07/14/2023
ForumsCategory: General questionscalculated count field based on non-empty text fields?
Jeff Wright asked 1 year ago

I'm building an event registration form. I want to create a calculated field for attendee count that is 2 if both "name" and "spouse name" fields are filled in, otherwise set attendee count to 1.  I thought this could be achieved via the () conditional, but I haven't been successful. Let's say "spouse name" is [100]. I tried setting a calculated default value for "attendee count" to both

([100]? 2: 1)

and

([100] != '' ? 2 : 1)

Neither of these worked. Any suggestions?

Rob LeVineRob LeVine replied 1 year ago

That type of calculation can't be used (see https://formidableforms.com/knowledgebase/field-calculations/conditional-calculations/) "Conditional calculations only work in numeric calculations and can not be used to compare text fields." It's easily accomplished with a couple of lines of jQuery though.

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