F
Filament5mo ago
Marc

Validation does not work

I have created a custom page, but the validation did not work, in "new_password" I put 123 and in "new_password_confirmation" 1234 and I do not get any validation errors, nor are the rules of "->rule()" being applied, this is the page code:
class ProfilePassword extends Page implements HasForms
{
use InteractsWithForms;

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make("current_password")
->required()
->password(),
Forms\Components\TextInput::make("new_password")
->password()
->minLength(5)
->rule(Password::default()->min(8))
->required(),
Forms\Components\TextInput::make("new_password_confirmation")
->password()
->same("new_password")
->required(),
]);
}
}
class ProfilePassword extends Page implements HasForms
{
use InteractsWithForms;

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make("current_password")
->required()
->password(),
Forms\Components\TextInput::make("new_password")
->password()
->minLength(5)
->rule(Password::default()->min(8))
->required(),
Forms\Components\TextInput::make("new_password_confirmation")
->password()
->same("new_password")
->required(),
]);
}
}
In blade file:
<x-filament-panels::page>
<x-filament-panels::form wire:submit="save">
{{ $this->form }}

<x-filament-panels::form.actions
:actions="$this->getFormActions()"
/>
</x-filament-panels::form>
</x-filament-panels::page>
<x-filament-panels::page>
<x-filament-panels::form wire:submit="save">
{{ $this->form }}

<x-filament-panels::form.actions
:actions="$this->getFormActions()"
/>
</x-filament-panels::form>
</x-filament-panels::page>
0 Replies
No replies yetBe the first to reply to this messageJoin