misc: limit dynamic first option label update to first empty choice (#86111) #1068

Merged
fpeters merged 1 commits from wip/86111-multiple-empty-option into main 2024-01-26 08:44:20 +01:00
1 changed files with 2 additions and 2 deletions

View File

@ -86,9 +86,9 @@ $(function() {
if ($widgets.length > 1) {
var values = $widgets.find('select').map((idx, elt) => {return $(elt).val()}).toArray().slice(1)
if (values.every(v => (v === ""))) { // all empty
$widgets.find('select').first().find('option[value=""]').text($(this).attr('data-first-element-empty-label'));
$widgets.find('select').first().find('option[value=""]').first().text($(this).attr('data-first-element-empty-label'));
} else {
$widgets.find('select').first().find('option[value=""]').text('---');
$widgets.find('select').first().find('option[value=""]').first().text('---');
}
}
}).trigger('change');