TextInput live onBlur does not seem to work as expected
I have this test and name field in my form:
Where I expect the name field to only trigger the afterStateUpdated() method when I leave the field, but I am experiencing that the live update is happening while the name field is still focused. Is this the expected behaviour?
I have attached a screen recording of the behaviour explaining the issue.
15 Replies
Solution
I had to refresh the page, then
live(onBlur: true)
works as expected.I'm still seeing this not working as expected. A request is sent as soon as a value is entered.
@Jon Mason Did you refresh your page? Please share your current code.
yes, I've refreshed, built, updated filament, everything I can think of.
Can you try it without the currencyMask()
Same result
Hmm. Not seeing anything obvious. Try removing things one at a time to see if you can track it down. Not often but sometimes the order of the modifiers can matter.
@Jon Mason I am having the same issue. Did you fix it ? Thanks in advance!
couldn't remember and was just looking at my code again. I haven't changed anything, and it looks like this isn't happening anymore. May try updating filament.
actually, I take that back, just realized this was about the requests getting sent immediately. I am still seeing this. I think I just gave up on it honestly.
actually, seems to be the
->currencyMask()
that's causign it. Commenting that out makes it work as expected.
I really want the currency mask though, so i'm ignoring the many requests it's sending.Thanks @Jon Mason
I just resolved the issue on my side putting the live() property after reactive()
You shouldn’t have live and reactive. They do the same thing. Reactive is legacy from v2.
I didn't know this...that's super helpful. I've wondered about that because it never made sense to me.
@awcodes thank you for your answer. I started my app using Filament v1 and I updated it to v2 and currently to v3. So I understand that the ->reactive() property to create dependant fields is replaced by ->live(). I am right?
I just confirmed by myself on vendor/filament/forms/src/Concerns/HasStateBindingModifiers.php:
I had the same issue for days, and i just found out that reactive is Legacy. so ->live(any param) won't work just because i reactive() next to live() function. So removed reactive() and everything works well now.