rumor
(rumor)
January 6, 2025, 11:50pm
1
I’m trying to create a multi-page form with about 11 pages. Pages 4-7 should repeat as the user can add and remove items.
So I’m thinking maybe I can use the Gravity Forms repeater example with a multi-page form as the repeater field inside of another multi-page form:
A repeater field is a collection of other Gravity Forms fields, combined together into a set that can then be used on a single form.
Est. reading time: 7 minutes
But I see the repeater form as a long one page form showing all the pages and next buttons. The add/remove buttons don’t do anything.
Is this even possible or am I crazy for trying this? Is there a better way to accomplish what I want?
david
(David (Gravity Wiz))
January 29, 2025, 6:13pm
2
That’s a gnarly idea! I’ve long wanted to build a Repeatable Page add-on but I hadn’t conceptualized the ability to repeat multiple pages…
I don’t think the Repeater API will serve you well here though. I think I’d handle the dynamic pages on gform_pre_process
. You can see some wild code we attempted to restructure pages for a different purpose here:
gravitywiz:master
← gravitywiz:dave/add/better-pagination-support
opened 12:41AM - 28 May 22 UTC
[HS#34770](https://secure.helpscout.net/conversation/1882336037/34770)
Custom… er was originally seeking a way to show the "Submit" button when the last page with fields had been reached. Previously, this snippet handled empty pages by automatically adjusting the target page to skip them on submission. It was feasible to dynamically change the name of the "Next" button when we knew that subsequent pages had no fields; however, this would not solve the issue where the pagination still showed additional pages.
I considered using JavaScript to interact with the pagination conditional logic to update the page navigation and button; however, I was honestly kind of curious about simply restructuring the form pages during the randomization rather than having to interact with the pagination conditional logic at all.
The basic logic is...
1. Filter the fields based on the specified options.
2. Get all the page numbers for the remaining fields (e.g. 1, 3, 4, 6).
3. Loop through the page numbers and reassign them to their new page numbers based on the index of the page numbers array.
4. As part of that loop, we also Inject the page field into the filtered fields and modify their page numbers accordingly.
I'm fairly happy with the result but I do have some concerns about brittleness. This has been tested with the customer's form extensively and it works with pages with only random fields, only static fields, and both random and static fields on the same page. Excited to see how this works in the wild!
**Edit: Sept 30th, 2023**
This ticket is requesting the same functionality (hiding pages with no fields) but in the context of Entry Blocks. Whatever lessons we find here can likely be applied there.
https://secure.helpscout.net/conversation/2373971553/55284/
This code would dynamically remove pages if there were no randomly selected fields on that page. In your case, you would want to dynamically add pages, but the concept is much the same. Just be sure to duplicate all the fields on those pages as well and give them IDs that won’t conflict with other field IDs on the same form.
system
(system)
Closed
February 28, 2025, 6:14pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.