Skip to content

Fix custom datepicker show field validation#19829

Open
wychoong wants to merge 2 commits intofilamentphp:4.xfrom
wychoong:fix/custom-datepicker-input-validation
Open

Fix custom datepicker show field validation#19829
wychoong wants to merge 2 commits intofilamentphp:4.xfrom
wychoong:fix/custom-datepicker-input-validation

Conversation

@wychoong
Copy link
Copy Markdown
Contributor

@wychoong wychoong commented May 8, 2026

Description

#19788

when using custom datetime pickerm if filled with time that is not passed with the html validation, it fails html validation and not focusable
console error when try to save form

An invalid form control with name='' is not focusable.   <input max="59" min="0" step="15" type="number" inputmode="numeric" x-model.debounce="minute">
   $this->form->fill([
            'started_at' => now()
                ->minute(18)
                ->hour(3)
                ->second(30),
        ]);
        
DateTimePicker::make('started_at')
        ->label('Started At')
        ->seconds(false)
        ->native(false) // without this the form can save without issue
        ->secondsStep(20)
        ->hoursStep(2)
        ->minutesStep(15),

Visual changes

the fix proposed in this PR does the following:

  • open the panel and retrigger the html validation
  • validate on blur for hour/minute/second inputs

this PR does not

  • validate on panel close
  • server side validation for hour/minute/second
image

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant