-
Notifications
You must be signed in to change notification settings - Fork 111
DropDown: purpose of isValueRequired=true ? #513
Copy link
Copy link
Closed
Labels
Description
$f = new \atk4\ui\Form(); // no model set
$f->addField('some_field', ....); // see https://github.com/atk4/ui/issues/512
$f->addField('format', ['DropDown', [
'isValueRequired' => true,
'values' => [
'csv' => ['CSV', 'icon' => 'tag icon'],
'txt' => ['TXT', 'icon' => 'file icon'],
],
]]);
$f->onSubmit(function ($f) {
var_dump($f->model->get());
});
related #512
If I open form and don't choose value in dropdown field, then it submits empty string as value. So the question is - what's the purpose of isValueRequired property. Shouldn't it also be detected as validation rule and give error that you can't submit empty value if field is required? Anyway I see some consistency problem here.
Reactions are currently unavailable