Open BenParizek opened 6 years ago
Hi
Sorry to resurrect an old ticket however we have an issue related to this. We have recently attempted to upgrade our Craft 2 installation to Craft 3, and have installed the most recent version of Sprout Forms. When attempting to use our v2 form, we now receive the attached error.
Can you tell us how we can restore the functionality to add Matrix fields to our forms? These fields were provided "out of the box" in the previous version and appeared as "Custom" fields.
Many Thanks
Hi @welford-media-ops
In Craft 2, Sprout Forms extended the Craft Field Layout Editor and allowed you to add any field that Craft supported to a Form. While you could add any field on the back-end, the back-end Form UI was handled by Craft and Sprout Forms only added supported for the front-end output of the fields for a subset of the fields on the front-end. We only officially supported fields in Craft 2 that did not require javascript on the front-end, and it was noted in our docs that it was possible to add support for fields outside of that but we considered those to be in the custom field category. In the backend, these other available fields appeared in the 'Custom' dropdown. Sprout Forms accepted data from fields like the Matrix (and any field Craft supported) but support for those fields had to be added manually via the front-end templates.
In Craft 3, Sprout Forms added a new Form Field API that now requires Form Fields to have both front-end and back-end support. We migrated support for all of the fields we officially supported on Craft 2 and added some additional fields. However, we have not yet tackled adding support for a Matrix-style field.
To add Matrix support, you will need to develop a Custom Form Field to support that field in Craft 3. I would guess that the work you did on the front-end side of things could largely be reused, but you would probably have to build out custom support for how users could define the Matrix Field on the back end and how the data was saved and retrieved from the database.
If I could be of help talking through what might be needed to build out a custom Form Field, feel free to book a coaching session and I'll do what I can to help understand what's needed for the Form Field custom development.
We won't be adding Matrix Field support by default in Sprout Forms. There is too much advanced functionality needed on the front-end and it would be hard for a plugin to make assumptions about what individual front-end needs would be.
At some point we could consider creating a separate Front-end Matrix Field integration plugin as an example for others to draw from.
For similar functionality, see Matt Blode's Tables Field for Sprout Forms