Header Action use form data
I am trying to make a header action that is a preview within my create and edit forms.
So you click it and a modal pops up and shows what it will look like in the front end of my application.
I have gotten a custom modal to pop-up and display.
The issue I am having is it only uses saved data. Is there a way I can make it use the data from the form.
Code I am using within getHeaderActions():
Action::make('preview')
->action(fn (Post $record) => $record->advance())
->modalContent(fn (Post $record): View => view(
'filament.pages.post.preview',
[
'post' => $record
]))
So you click it and a modal pops up and shows what it will look like in the front end of my application.
I have gotten a custom modal to pop-up and display.
The issue I am having is it only uses saved data. Is there a way I can make it use the data from the form.
Code I am using within getHeaderActions():
Action::make('preview')
->action(fn (Post $record) => $record->advance())
->modalContent(fn (Post $record): View => view(
'filament.pages.post.preview',
[
'post' => $record
]))
Solution
So you want the ownerREcord data, try: modalContent(fn(Post $record, $livewire):
then use $livewire->ownerRecord ?
but I believe page actions on may have access to the parent so:
dd($this->form) you should have the updated data
then use $livewire->ownerRecord ?
but I believe page actions on may have access to the parent so:
dd($this->form) you should have the updated data