How to render a Forms Builder component on front ?
Hi, perhaps my understanding of this is wrong. The output saved from a Builder component (filament v3) is an array or json.
Having read https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component I can output the same builder on front as I had in Filament, but what i'm looking for would be something like ->toHtml() or idk..
Did I misunderstand the purpose of the Builder Component ? I assumed it can be used as a sort of Page builder too and not just a Forms Builder?
2 Replies
For it to be used as page builder you need to parse the json form Builder and create a the components dynamically. I have used Builder to ceate forms and set up a FormBuilder class that gets the json from Builder as schema and builds the forms using Filament Components to be shown in the front-end. There has no automatic
->toHTML() etc. because Builders purpose is not to generate the html but just to have visual way to create the layout.Dan does show the principle of the original implementation here:
https://github.com/danharrin/form-builder
GitHub
GitHub - danharrin/form-builder: A demo of how to use filament/form...
A demo of how to use filament/forms to build a user-facing Form Builder which stores fields in JSON. - danharrin/form-builder