F
Filament5mo ago
Aminne

Show error field without closing modal in custom action

Actions\Action::make('disabledTwoFactor')->label('Enable Two-Factor Authentication')>requiresConfirmation()->modalSubmitActionLabel('Enable')
->form([
Forms\Components\TextInput::make('password')->password()
->revealable()
->required()])
->action(
function (array $data) { self::EnabledTwoFactor($data['password']);})->modalWidth('lg'),
Actions\Action::make('disabledTwoFactor')->label('Enable Two-Factor Authentication')>requiresConfirmation()->modalSubmitActionLabel('Enable')
->form([
Forms\Components\TextInput::make('password')->password()
->revealable()
->required()])
->action(
function (array $data) { self::EnabledTwoFactor($data['password']);})->modalWidth('lg'),
3 Replies
Aminne
AminneOP5mo ago
Hello, i want to show the error message without closing the modal how i can
awcodes
awcodes5mo ago
What does enabledTwoFactor do?
Aminne
AminneOP5mo ago
Forms\Components\TextInput::make('password') ->password()
->revealable()
->required()
->live(onBlur: true)
->rules([fn (): Closure => function (string $attribute, $value, Closure $fail) {
if (!Hash::check($value, auth()->user()->password)) {$fail('The provided :attribute is incorrect.');}
}])
Forms\Components\TextInput::make('password') ->password()
->revealable()
->required()
->live(onBlur: true)
->rules([fn (): Closure => function (string $attribute, $value, Closure $fail) {
if (!Hash::check($value, auth()->user()->password)) {$fail('The provided :attribute is incorrect.');}
}])
I resolved it by this
Want results from more Discord servers?
Add your server