FilamentF
Filament3y ago
Tom

Realtime field validation.

How can I have realtime validation> I am trying with the following with no success.

->afterStateUpdated(function ($livewire) {
$livewire->validateOnly('data.public_key');
})
Solution
Textarea::make('public_key')
    ->label(__('Public Key'))
    ->maxLength(255)
    ->rows(10)
    ->required()
    ->rules([new PublicKey])
    ->live(onBlur: true)
    ->afterStateUpdated(function ($livewire, $component) {
        $livewire->validateOnly($component->getStatePath());
    })
Was this page helpful?