Repeater Section: Adding up multiple Lookout Field values

By: Brandon Cross | Asked: 07/20/2023
ForumsCategory: Code HelpRepeater Section: Adding up multiple Lookout Field values
Brandon Cross asked 9 months ago


I've recently been racking my brain trying to figure out a solution to this problem I've encountered.

For context, the form is an order form. Within the order form, there is a Repeater Section. Inside the Repeater Section, there are four Lookup Fields.

Lookup Field 1 is the Product. Lookup Field 2 is the Format. Lookup Field 3 is the Size. Lookup Field 4 is the Price. I've imported a database of products, along with their format (ex: capsule, liquid, cream), the size/quantity (ex: 30ml, 250g, 45%) which then displays the price. These are all formatted neatly in a View, as Entries within a Form. This is where the data is being pulled from.

I use Lookup Field because some of the Product names repeat themselves, and rather than having "Product A Capsule 20g", "Product A Capsule 40g", and "Product A Capsule 80g" in the dropdown, it's easier to select the Product, and then the Lookup Field does the "logic", only the available format or size changing, which in turn changes the price. The Repeater Section is [158], the Product is [171], Format is [173], Size is [174] and Cost is [172]. The Repeater Section allows the person filling out the form to basically add another product, which all functions correctly.

The issue is that I cannot find a method to add up the Prices from each Repeater Section and have the total appear in an empty field outside the Repeater Section. I've tried everything that is available via the FormidableForm docs. I am aware of how the Repeater Section works, and how it basically embeds a child form, which is why for example the Lookup Fields corresponding to the Price are [158][x][172], I've done research - even coming up on the Javascript and guide Victor wrote to look at values of the rows and have specific values show up in a dropdown based on the first dropdown, but have not been able to resolve my problem. 

Any help would be appreciated.

1 Answers
Victor Font answered 9 months ago
You need to do this with jQuery.

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