Keeping the empty selection on OneToMany Dropdown


#1

Hi there,

this probably is pretty simple, but after lots of useless code-reading I thought this is worth a forum topic.

So imagine there is a Tour class which hasOne MeetingPoint. so, when setting
$form->setModel(new \Tour($app->db));
a dropdown is created in which user can select a MeetingPoints, all available meeting points are shown.

So now the task is to add another value to this dropdown. Actually, I am lost on this.
What I want to do is to add an “empty” selection to the top (id 0 or less, display text …). When there is no Meeting Point selected yet, this option is there, but once a meeting point is selected its gone.

Empty selection there:
empty_selection_there

Empty selection gone when a record was selected:
empty_selection_gone

Best regards
Philipp


#2

we used to have something like “empty value text” - something that appears when no values are selected. Also this should be a valid choice in the dropdown (except when required=true)

Autocomplete fields does not seem to respect that now. It’s a bug, please report.


#3