formie icon indicating copy to clipboard operation
formie copied to clipboard

Render formie straight from Json without Import

Open Megafry opened this issue 2 years ago • 2 comments

Question

All forms are stored in the database, but I haven't found a solution like FreeForm hat to save them in to the configuration. I found the option to export them as Json, but no option to render them directly from the Json file.

I want to create complex forms that only developers need to edit and can be stored as a file for easy deployment with git. Is there already a solution for this, how should I approach this problem?

Best regards

Additional context

No response

Megafry avatar Nov 05 '23 20:11 Megafry

I'm not familiar with that feature with Freeform I'm afraid, but as forms are elements and stored as content, they are saved to the database and not a file. You can indeed use the export to generate JSON, but you can't render based on that file alone - although that's probably a possibility.

The only way currently is to export/import forms, which can be overwritten. It's a bit cumbersome in your setup as it required manual handling.

You're probably the first person to ask for this, so happy to leave this open for some further interest!

engram-design avatar Nov 05 '23 20:11 engram-design

I created a workaround by adding a console\controller class to allow imports and exports of json. code: FormController.php

After each deployment, the extend-formie/form/import-all command is run.

Megafry avatar Mar 06 '24 12:03 Megafry