Form Builder: Modal-Form Action

Is it possible to create a form inside a modal which get triggered from a button / action (like in the table builder / admin panel) with the form builder package only? Background: I would like to use the Form Builder in a existing laravel (non filament) project and benefit from the forms and modals. Thank you!
22 Replies
Dan Harrin
Dan Harrin2y ago
in v3 this is possible
LeandroFerreira
Hi @prodex, I have a project with form builder and it is possible. Take a look:
toeknee
toeknee2y ago
You can use custom views obviously, and if an action within a form you can use drop-in-action
LeandroFerreira
<!-- register-form.blade.php -->
<x-filament-support::modal
id="modalForm"
darkMode="true"
width="xl">

<form wire:submit.prevent="submit">

{{ $this->form }}

<x-filament-support::button
class="mt-4"
type="submit"
wire:target='submit'>
Submit
</x-filament-support::button>

</form>

</x-filament-support::modal>

<x-filament-support::button
@click="$dispatch('open-modal', { id: 'modalForm' })"
class="mt-4"
type="button">
Open the modal
</x-filament-support::button>
<!-- register-form.blade.php -->
<x-filament-support::modal
id="modalForm"
darkMode="true"
width="xl">

<form wire:submit.prevent="submit">

{{ $this->form }}

<x-filament-support::button
class="mt-4"
type="submit"
wire:target='submit'>
Submit
</x-filament-support::button>

</form>

</x-filament-support::modal>

<x-filament-support::button
@click="$dispatch('open-modal', { id: 'modalForm' })"
class="mt-4"
type="button">
Open the modal
</x-filament-support::button>
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
LeandroFerreira
Can you share the code please?
Dan Harrin
Dan Harrin2y ago
send code.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
"submit" not 'submit'
LeandroFerreira
where is your <form> tag?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
remove attributes, one of them will probably be problematic
LeandroFerreira
Can you share the whole code? In this case, you can use <x-filament::button> I think
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
both should work, i think theres just a syntax error somewhere
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
you shoudldnt need a custom view like this to make a basic resource
LeandroFerreira
I agree But if you want to send that data that way, you need to set a <form wire:submit.prevent='create'> I think
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Dan Harrin
Dan Harrin2y ago
just copy the code from /vendor create-record.blade.php and modify it?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server