Dependent select and datatime picker fields.
i have this line of code for setting the value of datatime picker based on selected field
Select::make('status')
->searchable()
->options([
'published' => 'Published',
'draft' => 'Draft',
])
->live()
->afterStateUpdated(fn (Set $set) => $set('scheduled_at', now()))
->required(),
DateTimePicker::make('scheduled_at')
->rules(['date'])
->displayFormat('d-M-Y h:i A')
->minDate(now())
->required()
->placeholder('Scheduled At'),
perticularly it is not working for the datatime picker if there is any alternative please suggest me and i want both the fields to be visible.
2 Replies
try adding
->live()
to the DateTimePicker?! not sure tho^If that doesn't work, the
DateTimePicker
field may just need to be reinitialized so you can try doing this and it may potentially work idk: