Added better support for handling pages with no fields after randomization. #334
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HS#34770
Customer 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...
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/