F
Filamentβ€’4mo ago
alembily

Help with Flatpickr plugin

Hi everyone πŸ‘‹ I'm a new Filament user and I'm facing an issue with Flatpickr plugin issue. I have a basic setup only 2 resources. I used Flatpickr as month picker and it works fine but when I validate it on BE, it is not working anymore. After validation id becomes a regular text input - I tracked this in html (see screenshot).
Flatpickr::make('valid_for')
->allowInput(false)
->monthSelect()
->dateFormat('Y-m-d')
->default(Carbon::now()->toISOString())
->required()
->rules([
function (callable $get) {
return function (string $attribute, $value, Closure $fail) use ($get) {
$membership = Membership::where('player_id', $get('player_id'))
->where('valid_for', Carbon::make($value))
->first();

if ($membership) {
$fail('Record with this value exists.');
}
};
},
])
Flatpickr::make('valid_for')
->allowInput(false)
->monthSelect()
->dateFormat('Y-m-d')
->default(Carbon::now()->toISOString())
->required()
->rules([
function (callable $get) {
return function (string $attribute, $value, Closure $fail) use ($get) {
$membership = Membership::where('player_id', $get('player_id'))
->where('valid_for', Carbon::make($value))
->first();

if ($membership) {
$fail('Record with this value exists.');
}
};
},
])
Any help is appreciated.
No description
No description
No description
2 Replies
Wirkhof
Wirkhofβ€’4mo ago
try to add ->live() there
alembily
alembilyβ€’4mo ago
now it becomes a text input after a calendar select 😦