F
Filament6mo ago
Ferre

Preview a livewire component with form in a Filament settings page, gives 500 error

Hey guys, I have a pretty specific question, will try to explain as well as possible. I have a booking widget and a Filament page with the widget settings (1). On the settings page I want to show a preview of the widget (2), this idea I got from the invoice page on https://github.com/andrewdwallo/erpsaas/. In the screenshot below you see a var_dump of the form, more to show that this should be the location of the livewire component. The problem I am running into is Filament giving a 500 error, and this only happens when the form of the widget is rendered. I think the issue has to do with Filament being confused there are two form variables on the page. Any ideas on how I can make this work?
No description
Solution:
Update: I have figured it out! I just needed to add a Blade component with @livewire('booking-widget', ['settings' => $settings]) and render it on the Filament page: ```ViewField::make( 'preview' ) ->hiddenLabel() ->view( 'filament.components.preview-booking-widget' ) ->viewData( [ 'settings' => $this->settings, ] ),...
Jump to solution
3 Replies
Solution
Ferre
Ferre6mo ago
Update: I have figured it out! I just needed to add a Blade component with @livewire('booking-widget', ['settings' => $settings]) and render it on the Filament page:
ViewField::make( 'preview' )
->hiddenLabel()
->view( 'filament.components.preview-booking-widget' ) ->viewData( [
'settings' => $this->settings, ] ),
ViewField::make( 'preview' )
->hiddenLabel()
->view( 'filament.components.preview-booking-widget' ) ->viewData( [
'settings' => $this->settings, ] ),
Want results from more Discord servers?
Add your server