1

We have a placement tool that is currently based on a proprietary PHP MVC framework. We have a need to quickly build custom forms that contain various checkbox, radio and text fields.

We want to store/retrieve the entire form data in our database, outside of Craft, into a custom jsonb column, along with special key fields, etc. We currently call our custom Craft plugins from our legacy framework via specified url/action and parameters (which displays the content in an iFrame). We'd probably use the same method for forms as well, until we can migrate or go to a Vue.js/Headless Craft setup.

Other forms tools, I have reviewed, store the forms within Craft as 'submitted' forms. We need to keep them in our own database.

Thanks!

  • Thank you Sir, for you speedy reply!, This sounds great. Basically, I would like to use your plugin to build/store & manage forms and then use custom integrations to interact with my backend and database. - D – Unlimited Nov 23 '19 at 6:16
2

Generally speaking, as I may not understand everything you are trying to do, it may be easiest to just have a custom module watch the \barrelstrength\sproutforms\elements\Entry::EVENT_BEFORE_SAVE Event and store the data as a JSON blob wherever you'd like.

If you don't wish to store the data in the normal way Sprout Forms lets you disable saving data to the database, or enable it and set the default to off so you only need to turn it on for use cases where you may want it to store the data in the plugin itself.

As far as retrieving that data, that would be up to you as you're storing it in a way that Sprout Forms wouldn't understand unless you retrieve and re-populate a Form Entry Model at some point in your workflow.


For a more integrated solution, you may want to explore Sprout Forms Custom Integrations API.

Integrations will run after a Form Entry is submitted and validated so you can use the Sprout Forms form builder to build and validate forms (and use features like conditional fields) and then, once the form is submitted you can hand things off to your Custom Integration and send the data wherever you'd like (to a third-party API or just somewhere else in the same database as you describe).

Some of the default integrations give examples on how you can build an Integration to handle custom mappings where you give the admin user an option to map the form fields they create to wherever you want to send the data to, however, Integrations don't require a mapping. If you just want to send the whole payload to a custom endpoint, you can do so and configure the endpoint of your other application to know what to expect.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.