Little help with custom form input
Hey guys, how are you?
I'm trying to create a custom input, but I can't capture the value generated by it, and the examples I found weren't very good...
I want to interact with these two range sliders, to generate a kind of XY coordinate to position something somewhere else. I can combine and handle the update of the sliders to compose my coordinate, but this value doesn't seem to be visible to other inputs or components of the form. Should I configure some method in the input class for this or should it work automatically? Debugging through the state I can see that the value I expect is in fact in the state, but for some reason I can't capture it in a livewire component of the same form.


7 Replies
Is the component live? Otherwise the state will only be sent to the server when you click the save button
Yes, its a live component. In fact I've tried live and reactive, no joy. Also tried to dd the state on the afterStateUpdated, but it wont fire unless I chance anything else on the form, dont really know why.
I guess I'm missing something in the component view...
I'm using two sliders to make up the state for this component, looks like it doesnt auto read back the state property this way
You are not applying the state modifiers here:
state: $wire.$entangle('{{ $getStatePath() }}'),
Smol progress, the afterStateUpdated is firing on every change on sliders π

and its in fact updating my livewire component
Thank you Dennis, you killed it
π