F
Filament14mo ago
Skjena

Value keeps getting deleted automatically inside TextInput field.

Some values are immediately removed while typing in the TextInput field, especially when typing quickly. Here is that TextInput field code
TextInput::make('name')
->afterStateUpdated(function (\Filament\Forms\Set $set, $state, $context) {
if ($context === 'edit') {
return;
}
$set('slug', Str::slug($state));
})
->reactive()
->required()
TextInput::make('name')
->afterStateUpdated(function (\Filament\Forms\Set $set, $state, $context) {
if ($context === 'edit') {
return;
}
$set('slug', Str::slug($state));
})
->reactive()
->required()
i think the issue with reactive() and live() , because when i use lazy() there is no such issue. Could you help me out with this issue ? Thanks.
3 Replies
krekas
krekas14mo ago
You said yourself. Don't use live() use live(onBlur: true). It's just v3 syntax
Skjena
SkjenaOP14mo ago
Thanks for the tip but this is just like what lazy() does. Is it possible to use reactive() since I want to live update?
krekas
krekas14mo ago
As I said it's just a v3 syntax. Maybe you could use debounce instead
Want results from more Discord servers?
Add your server