Confirmation message on custom action modal
I had an expectation that chaining the requiresConfirmation() method to my custom page action in which form() and action() is defined would display the confirmation modal only when submit button is click. However, it displays as part of the action modal instead. Would appreciate any help to tackle this.
p/s: the whole purpose of this is to prevent user accidentally submit on enter.
11 Replies
No, requiresConfirmation is used on actions that are automatic. I.e. toggling etc. By injecting a form into it, you make it a confirm. What you want to do is remove the confirmation option since you have a popup form by placing form in there already.
so my form became the confirmation.. i see welp
Yep!
guess i'll just educate the user to double check their info lol
Yep... But if you want to confirm, you could place a basic wire:confirm as an extra atribute on a custom submit button?
https://livewire.laravel.com/docs/wire-confirm
Laravel
wire:confirm | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
i'll give it a try, so using makemodalsubmitaction? extramodalfooteractions?
modalActions IIRC, been a while since i have done it
This ends up being my solution aha, it both prevent submit on enter and displays an ugly browser confirmation message
not really sure how to customize the modal
nvm shortlived, it couldnt find 'save' method when submitted
You'll need to make the action a SaveAction not StaticAction I believe? The confirmation message for livewire is just a browser JavaScript one tbh
there's a SaveAction?
Solution
Solved it, it's
'wire:click' => 'callMountedAction([])'
.