Modal from an extra footer action to bind with modal form?
Is there a way make modal extra footer action to work with modal the modal form in terms of validation and form data access. The point is to be able to trigger confirmation after filling the modal form before action.
Action::make('edit')
->form([
// ...
])
->extraModalFooterActions([
Action::make('submit')
->requiresConfirmation()
->action(function () {
// $data
}),
])
Solution:Jump to solution
Sorry guess I’m just not fully following the use case. Is this what you are trying to achieve: https://filamentphp.com/docs/3.x/actions/modals#opening-another-modal-from-an-extra-footer-action
12 Replies
????
Why not just have the confirmation on the parent modal? Not following the use case.
The parent modal is treated as form instead with 3 select input. Like a quick condition before the actual action. Does that make sense?
??
Might. Be better to override the default submit action. https://filamentphp.com/docs/3.x/actions/modals#modifying-a-default-modal-footer-action-button
tried them but non has requireConfirmation()
I’m not sure if it works with extra footer actions, but you could try injecting the $data into the function callback.
https://filamentphp.com/docs/3.x/actions/advanced
I would still expect requiresConfirmation() to work on the main action though.
yes $data do work here. the issue is getting a confirmation before final submit. I treated the first modal as form submission. so form was used instead of confirmation.
According to the docs it should just work without the extra modal actions. https://filamentphp.com/docs/3.x/actions/modals#confirmation-modals
I'm using a modal form which also behave like a confirmation. the submit action simply take off. Was looking for a situation where the submit triggers another modal action for confirmation.

Solution
Sorry guess I’m just not fully following the use case. Is this what you are trying to achieve: https://filamentphp.com/docs/3.x/actions/modals#opening-another-modal-from-an-extra-footer-action
Oh wow this just worked effortlessly, thank you. Then i was able to pass the form $data from the parent modal with
$data = $livewire->mountedTableActionsData[0];
. It wasn't avaiable in $data array.