Conditional Logic Issue: Hiding Form Fields Based on Quantity Selection
-
Hello,
I am developing a website where parents register their children for a hockey camp. The current workflow is as follows:
- The parent selects whether they are registering 1 or 2 children.
- They proceed to a form to enter their personal details.
- They then fill out custom fields for each child.
The Problem: Even if a parent selects only one child, the input fields for the second child remain visible. I previously used a PHP snippet to hide these fields, but after a recent update, this solution stopped working.
Another issue with the previous snippet was related to required fields. Even when the fields for the second child were hidden, the form would not submit because the “required” validation was still active for those hidden fields.
My Question: What is the best way to dynamically hide/show specific form fields based on the number of participants selected? Ideally, I am looking for a solution where hidden fields do not trigger “required” validation errors.
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.