Can't set DatePicker as required

Hello, I'm using the Form Builder on a custom Widget of mine. I can't set the DatePicker as required, a TextInput or a Select works as usual. When I click submit without filling the textinput the field says it's required, on the datepicker this doesn't happen.
class TransactionSum extends Widget implements HasForms
{
use InteractsWithForms;

public string $until = '';
public string $test = '';

protected function getFormSchema(): array
{
return [
Forms\Components\TextInput::make('test')
->required(), // this one is working
Forms\Components\DatePicker::make('until')
->required(), // this one is not
// ...
];
}
class TransactionSum extends Widget implements HasForms
{
use InteractsWithForms;

public string $until = '';
public string $test = '';

protected function getFormSchema(): array
{
return [
Forms\Components\TextInput::make('test')
->required(), // this one is working
Forms\Components\DatePicker::make('until')
->required(), // this one is not
// ...
];
}
2 Replies
Dan Harrin
Dan Harrin2y ago
when you call $this->form->getState() the form will validate if you dont do that, then only frontend vailidation will apply the date picker doesnt have frontend validation as it isnt a native HTML input type
Quadrubo
QuadruboOP2y ago
ah okay thanks that explains it, only worked with the admin panel right now that did all that stuff for me, thank you!
Want results from more Discord servers?
Add your server