I have a form that spans two pages, with a required field on both pages and an optional field on both pages:
Form A - Page 1
- Question 1 (required)
- Question 2 (optional)
[User submits partial form to database]
Form A - Page 2
- Question 3 (required)
- Question 4 (optional)
[User submits partial form to database]
The Form is creating an ElementType in Craft and the questions are Custom Fields. The user who creates the Form can arrange any number of custom fields required or optional on any number of tabs.
How do I think about validation for this workflow? When I create a Model to validate the forms being submitted, required fields should only trigger validation errors when the page they are on is submitted.
I'm happy to do more digging myself on this one if you can help point me in the right direction, but I'm not sure how to frame what I'd like to do. Does anyone have a better framework of how to think about how to validate conditionally required fields in the context of Models, Records, Element Types, and Custom Fields?