Hello, just tired out yamlforms and ... awesome. Thank you.
I need four registration forms that are independently manged by different owners (schools). I would like to combine the multiple registration forms in to one presentation for the applicants.
Applicants check which schools they are applying for and only the field needed, as determined by school selection, are presented to the applicant (and not in duplicate, the applicant only needs to fill-in their name once kind of thing).
Each school would also have its own handler and ignores submissions unless its school is selected. There could be multiple submissions (one for each selected school) or one combined, either would work.
Is this something that yamlforms could be extended for our do you suggest a special purpose custom module? Thank you again for the amazing contrib!
Comments
Comment #2
jrockowitz commentedIt sounds like you can use the YAML Form's Conditional Logic (aka #states API) to hide/show elements based on the selected school.
For "Each school would also have its own handler and ignores submissions unless its school is selected. " you will
have to write some custom YamlFormHandler.
Comment #3
tomdavidson commentedConditional logic will work if the school selection is part of the form. It appears that I can use other entity states as well, such as the school selection being its own independent form, but I have not been able to verify this. The custom handler for each school is a clear path as well.
The concern that causing head scratching is composiblity.
1) Each school would maintain its own registration YamlForm somewhat independent of the other schools but the registration forms are not freestyle:
* schools follow a convention on field labels
* schools follow a convention on page/steps names
2) The applicants would use a view or panel that would display/mash-up several YamlForms:
* A form for the school selection
* No duplicate fields (one field for birth date rather than one for each school)
* If a selected school has a field as required but another selected school as the same field as optional, then it is required.
* the applicant follows the set convention of pages/steps with the selected schools' field for the respective pages.
I am using the registration as the use case for such functionality but I think the composible YamlForm would be valuable in many other usages as well.
Comment #4
jrockowitz commentedSurprisingly, I have built composable forms before but I never called it that.
I am not ready to support this in the main YAML Form module.
I actually think you could build a handler where the base form would be empty and the handler would reference multiple forms that are merged into one form.
Comment #5
tomdavidson commentedmind sharing/elaborating on your "composable" form experience?
Im putting together a poc using yamlforms. If we end up using it behond poc I would be interested in contrib the functionality - any direction is welcome.
Comment #6
jrockowitz commentedI had a drush command that aggregated the multiple forms into a master form that could be altered and cached.
Comment #7
jrockowitz commentedI am adding this request to the YAML Form module's roadmap. I still not sure if composite forms is feasible and if should be supported the main module.
I created a new ticket that uses the issue tracking template #2824714: Provide mechanism to build composite and/or base forms