Is it possible to add validation to a `Action::make()` before opening the confirmation modal?
I have added a header action to my table, where I have tried to add validation in the
->before()
lifecycle hook:
But the before hook does not trigger before the confirmation modal is opened. Am I doing something wrong? Or is there simply no lifecycle hook that triggers before the action modal is opened?4 Replies
@nowak Did you manage to get this working?
@Jacob Not the way I wanted, as I don't know if a hook like this exists. So I added a conditional tooltip to my action button as well as color and icon, modal content, and submit button. This way whenever I want my action to not be validated, there is plenty of feedback to the user and they will not be able to confirm the modal if it isn't validated.
Here is an example of how I conditionally show the color and icon:
Ok thx!
I managed to get it working using the
->beforeFormFilled()
method, but this requires you to use an form inside the modal.
@Jacob Awesome! Good to know. I do not use a form inside the modal though, but maybe I could add an empty or hidden form 🤔