custom field live(onBlur: true) firing immediately
I have a custom field where I'm trying to use
onBlur:true
, but the event is firing immediately. onBlur doesn't seem to work as expected.
MathInput::make('test')
->live(onBlur: true)
->afterStateUpdated(function (?string $state, ?string $old) {
dd($state);
});
MathInput::make('test')
->live(onBlur: true)
->afterStateUpdated(function (?string $state, ?string $old) {
dd($state);
});
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<div x-data="{ state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }} }">
<x-filament::input.wrapper>
<x-filament::input type="text" x-model="state" />
</x-filament::input.wrapper>
</div>
</x-dynamic-component>
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<div x-data="{ state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }} }">
<x-filament::input.wrapper>
<x-filament::input type="text" x-model="state" />
</x-filament::input.wrapper>
</div>
</x-dynamic-component>
1 Reply
This worked:
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<div x-data="{
state: $wire.entangle('{{ $getStatePath() }}'),
updateState() {
this.$wire.set('{{ $getStatePath() }}', this.state);
}
}">
<x-filament::input.wrapper>
<x-filament::input type="text" x-model="state" @blur="updateState" />
</x-filament::input.wrapper>
</div>
</x-dynamic-component>
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<div x-data="{
state: $wire.entangle('{{ $getStatePath() }}'),
updateState() {
this.$wire.set('{{ $getStatePath() }}', this.state);
}
}">
<x-filament::input.wrapper>
<x-filament::input type="text" x-model="state" @blur="updateState" />
</x-filament::input.wrapper>
</div>
</x-dynamic-component>