JS in login page

Hey! I created a new login page and I would like to config it a little bit. Maybe when an error message pops up, the Login button will dissapears. So my question is, there is any way to change the components behaviour with some Javascript code? Thanks for the answers!
11 Replies
toeknee
toeknee2w ago
Just add the JS to the page? OR condition the submit button based on the action happening
Sector
Sector2w ago
It's should happen after the user hitting the Login button.
toeknee
toeknee2w ago
So you want to disable when theres an error and how should it be re-enabled?
Sector
Sector2w ago
I don't want to re-enable it. When the user hitting the Login button, he will get a magic link via email, which helps him to logging in. So I just want to disable the button, to avoid spam.
toeknee
toeknee2w ago
Medium
How to disable button on click with AlpineJS
Sometimes, we want to disable a button on click to avoid double-entry submission. This is especially critical on forms that would create…
Sector
Sector2w ago
And how do I add JS to the Login page?
Tetracyclic
Tetracyclic2w ago
You can provide your own Filament page to the login() method on the panel, extending the original login class and overriding anything you need to, including providing your own view: https://filamentphp.com/docs/3.x/panels/users#authentication-features
Tetracyclic
Tetracyclic2w ago
You could also potentially use the PanelsRenderHook::AUTH_LOGIN_FORM_AFTER or PanelsRenderHook::AUTH_LOGIN_FORM_BEFORE render hooks
Sector
Sector2w ago
Yeah, I already did that, but the question is, where should I write the Javascript code, to change the components behaviour?
toeknee
toeknee2w ago
So you add it in the blade file.... if you need to add it to form emlements then use ->extraAttributes([])
Sector
Sector2w ago
Thanks for the help, all clear.