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
Just add the JS to the page? OR condition the submit button based on the action happening
It's should happen after the user hitting the Login button.
So you want to disable when theres an error and how should it be re-enabled?
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.
Ok.. so use alpine?
https://jianjye.medium.com/how-to-disable-button-on-click-with-alpinejs-4a536cbb63ac\
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…
And how do I add JS to the Login page?
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-featuresYou could also potentially use the
PanelsRenderHook::AUTH_LOGIN_FORM_AFTER
or PanelsRenderHook::AUTH_LOGIN_FORM_BEFORE
render hooksYeah, I already did that, but the question is, where should I write the Javascript code, to change the components behaviour?
So you add it in the blade file....
if you need to add it to form emlements then use ->extraAttributes([])
Thanks for the help, all clear.