Skip to content
Snippets Groups Projects
Commit a82d2681 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fixes #3767

Closes #3767

Merge request !2642
parent 7d4e4ca6
No related branches found
No related tags found
No related merge requests found
......@@ -292,14 +292,15 @@ class Resources
//Something is wrong.
return;
}
let options_html = '';
let options = [];
for (let option of option_select_options) {
let splitted_option = option.split('~~');
options_html += '<option value="' + splitted_option[0] + '">'
+ (splitted_option[1] ?? splitted_option[0])
+ '</option>';
const opt = $('<option>', {
value: option,
text: option,
});
options.push(opt);
}
$(new_criteria_select).append(options_html);
$(new_criteria_select).append(options);
} else if (option_type === 'date') {
let time_inputs = jQuery(new_criteria).find('input[data-time="yes"]');
let date_inputs = jQuery(new_criteria).find('input[type="date"]');
......
......@@ -64,14 +64,11 @@
<?= htmlReady($criteria['title']) ?>
<select name="<?= htmlReady($criteria['name']) ?>">
<? if (is_array($criteria['options'])): ?>
<? foreach ($criteria['options'] as $title):
$chunks = explode('--', $title, 2);
$value = $chunks[1] ?? $chunks[0];
?>
<option value="<?= htmlReady($value) ?>"
<?= $value == $criteria['value'] ? 'selected' : '' ?>
<? foreach ($criteria['options'] as $title): ?>
<option value="<?= htmlReady($title) ?>"
<?= $title == $criteria['value'] ? 'selected' : '' ?>
>
<?= htmlReady($chunks[0]) ?>
<?= htmlReady($title) ?>
</option>
<? endforeach ?>
<? endif ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment