backoffice: never allow invalid geojson data source selection (#55720)

This commit is contained in:
Frédéric Péters 2021-07-20 18:31:01 +02:00
parent 015caf1e78
commit 5a61721146
1 changed files with 5 additions and 0 deletions

View File

@ -282,6 +282,11 @@ $(function() {
if ($('select[name="data_source$type"] option:selected:visible').length == 0) {
$('select[name="data_source$type"] option:visible').first().prop('selected', true).trigger('change');
}
if ($('select[name="data_source$type"] option:selected:visible').length == 0) {
// stil empty, it means there are no geojson sources at all, display
// first option (which will be "None").
$('select[name="data_source$type"] option').first().show().prop('selected', true);
}
}
if ($(this).val() == 'timetable') {
$('input[name="data_mode"][value="simple-list"]').prop('disabled', true);