F
Filament4mo 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
Aminne4mo ago
Hello, i want to show the error message without closing the modal how i can
awcodes
awcodes4mo ago
What does enabledTwoFactor do?
Aminne
Aminne4mo 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