Controlling number of repeatable fields based on another field's value

Est. Reading: 2 minutes
By: liongabriel
Created: 04/30/2018
Category:
Difficulty: Intermediate

Controlling number of repeatable fields based on another field's value

×Warning: This tutorial was created 2417 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

This was my issue:

I have a registration form that I need to be able to have people add other users with a significant repeating section. But I need to calculate the total based on how many people are registering. My former solution was to add a "total number of people" field and force the registrar to add the number of how many people they were registering - but there was room for error, and the big issue was that they didn't HAVE to enter each person in order to submit. I need every person's info, so that wasn't going to work.

Here is my solution (see below for the exact documentation I used):

Inside the "repeater" section, I created a hidden number field (showing only to the administrator) and told it to to equal "1".

Then I created a second text field (also hidden) OUTSIDE the repeater section and I calculated the value based on my hidden number field in the repeater section.

It automatically adds the number of people who are added just like I want.

Then I used another text field to calculate my total.

 


https://Formidableforms.com/knowledgebase/repeatable-section/#kb-total-a-field-inside-a-repeater

Total a field inside a Repeater#

To get a total of the values in a field in a Repeater, you can:

  1. create a field outside of the Repeater to hold the total
  2. in the Dynamic default value box, check the Calculations checkbox
  3. in the Calculations box, put the [id] or [key] of the field inside the Repeater that you want to total

The values in the field in the Repeater will be added together automatically. If the values in the Repeater are words instead of numbers, you can check the text calculations checkbox, too. The total field will contain a comma-separated list of the values in the field in the Repeater.

Leave a Reply

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
crosschevron-leftchevron-rightarrow-right