F
Filamentβ€’9mo ago
Skrypt

Action Modal on Simple Pages?

Hey, is there any way to add the ability to open modals on actions (such as confirmation modals) within a simple page? I have extended the default Login / Register views, but no matter what I do, actions that should open modals just don't work.
5 Replies
Dennis Koch
Dennis Kochβ€’9mo ago
I guess the modal components aren't included on the simple page.
Skrypt
SkryptOPβ€’9mo ago
I did add the <x-filament-actions::modals> component if you mean that. It's still not doing anything though. It just simply runs the action instead of first confirming via a modal.
Dennis Koch
Dennis Kochβ€’9mo ago
Hm. I am not sure then, sorry.
Skrypt
SkryptOPβ€’9mo ago
No worries, thanks anyways. πŸ™‚ For other people who might stumble upon something similar, I think I finally found the issue, I had to pass a closure to the action method.
->action('doSomething')
->action('doSomething')
didn't work, but
->action(fn() => $this->doSomething())
->action(fn() => $this->doSomething())
did. I'm pretty sure I tried that before already though, so I have no idea why it now works. πŸ˜„
James
Jamesβ€’8mo ago
I had this issue and I found it was due to my action method name 'integrateActivityAction' didn't match the string in Action:make('integrateActivity'). The key part in source code is here: if ( (! str($name)->endsWith('Action')) && method_exists($this, "{$name}Action") ) { $methodName = "{$name}Action"; } elseif (method_exists($this, $name)) { $methodName = $name; } else { return null; } (this is in getAction in IntertactsWithActions.php)

Did you find this page helpful?