trigger action

Action::make('preview') ->label('プレビュー') ->icon('heroicon-o-eye') ->color('gray') ->extraModalWindowAttributes(['class' => 'upload_cover_image']) ->modalHeading('') ->modalContent(fn($record): View => view( 'test', ['record' => $record], )), I have the above action in the action table. In the modal of the above action there is a button as below <button wire:click="showFieldEditor(3)" style='color: #ffffff; font-weight: bold; background: #33456E; border-radius: 6px; padding: 6px 45px; font-size: 14px'> 編集する </button> When i press this button i want another action to be executed (this frozen action is also writing in the table action) i tried other ways but only the action preview is closed, but the action is not executing according to its mode
No description
7 Replies
toeknee
toeknee3w ago
No form is set in preview so just the action() if it has one would be triggered. You need to define an ->action() and a ->form() for a modal last time I checked.
ashfall
ashfallOP3w ago
I want to reuse the upload music action so that when I click the button, the action will work.
toeknee
toeknee3w ago
But the action won't work at all without the functions being defined
ashfall
ashfallOP3w ago
I don't quite understand, can you explain more? Thanks.
toeknee
toeknee3w ago
in the above you have 'Action::make('preview')' this doesn't have an ->action() or a ->form(). So it will not show a modal and won't run any code... If you want to show a modal, add
->form(fn($record) => [Viewfield::make('field')->view('test', ['record' => $record]))
->form(fn($record) => [Viewfield::make('field')->view('test', ['record' => $record]))
and
->action(fn($data) => return true)
->action(fn($data) => return true)
ashfall
ashfallOP3w ago
ah, this Action I just need to enable 1 modal to display view< In that view I have 1 button, the problem is I can't handle when clicking the button then action upload_music runs
toeknee
toeknee3w ago
Add an event listener?

Did you find this page helpful?