How to get real-time validation error before clicking create/save button

Forms\Components\DateTimePicker::make('start_date')
->label('Start Date')
->required()
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
if ($value && Carbon::parse($value)->lt(Carbon::today())) {
$fail('The :attribute must be today or later.');
}
},
]),
Forms\Components\DateTimePicker::make('start_date')
->label('Start Date')
->required()
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
if ($value && Carbon::parse($value)->lt(Carbon::today())) {
$fail('The :attribute must be today or later.');
}
},
]),
2 Replies
Want results from more Discord servers?
Add your server