afterStateUpdated not work on custom field
Hi 👋, I've created a new “TypeCylinder” field in my form. It works fine, except that I can't get the afterStateUpdated() method to work, as it never seems to be called... Any idea why?
Here the input on the form :
The field class (CylinderType.php) :
Solution:Jump to solution
state should also be
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }}
...12 Replies
And the view :
Add
live()
Thanks for your reply 🙂
I've just tried it, but it's the same thing: when I click on one of my inputs, nothing happens...
Is there anything missing in my component view to make the
afterStateUpdated()
functional?
My aim is to change the value of another field according to what we've chosen. Maybe is there any other way?you should use
<input {{ $applyStateBindingModifiers('wire:model') }}="{{ $getStatePath() }}" />
Thanks again for your help.
I just made the change.
I don't get my DD() if I click on one of my radio buttons from my CylinderType input.
However, I've noticed that if I click on any other input with a ->live() method, the DD() from my afterStateUpdated() appears.
share the blade file again, with the changes
Here you are : https://gist.github.com/AlexandreCConcept/0e7ec7bf3bb5b2f2c54ec5fc8803f23c
Thanks for your time
Gist
View for the CylinderType Input
View for the CylinderType Input. GitHub Gist: instantly share code, notes, and snippets.
there is no problem, I guess
are you clicking in the radio input?
Ah... I feel very stupid right now... đź«Ł I'm sorry...
I clicked on the label, which then selected the radio...
Is it possible to have the afterStateUpdated called when the label is clicked? 🤔
changing the state with
@click
I thinkSolution
state should also be
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }}
Okay, that's it. It works 🥳
Thank you so much for your help and patience
Filament has an amazing community 🙏