diff --git a/lib/classes/databox/subdefsStructure.php b/lib/classes/databox/subdefsStructure.php index 06f8b22425..6feb183a5b 100644 --- a/lib/classes/databox/subdefsStructure.php +++ b/lib/classes/databox/subdefsStructure.php @@ -197,6 +197,8 @@ class databox_subdefsStructure implements IteratorAggregate, Countable $subdef = $dom_struct->createElement('subdef'); $subdef->setAttribute('class', $class); $subdef->setAttribute('name', mb_strtolower($name)); + + $preset = ($preset == 'Choose') ? 'Custom' : $preset ; $subdef->setAttribute('presets', $preset); $mediaTypeElement = $dom_struct->createElement('mediatype'); diff --git a/templates/web/admin/subdefs.html.twig b/templates/web/admin/subdefs.html.twig index a1400ba4af..1a707036d8 100644 --- a/templates/web/admin/subdefs.html.twig +++ b/templates/web/admin/subdefs.html.twig @@ -227,6 +227,17 @@ } } + function isOptionChosen(o) { + console.log(o.val()); + if (o.val() != 'Choose') { + return true; + } else { + o.addClass("ui-state-error"); + updateTips("Choose an option"); + return false; + } + } + function checkPresence(mediaType, o) { var el = $('input[name="subdefs[]"][value="' + mediaType + '_' + o.val() + '"]'); @@ -268,6 +279,8 @@ allFields.removeClass("ui-state-error"); bValid = bValid && checkLength(name, "subdef name", 3, 16); + bValid = bValid && isOptionChosen(subviewType); + bValid = bValid && isOptionChosen(mediaType); bValid = bValid && checkSpecialChar(name); bValid = bValid && checkPresence(subviewType.val(), name); bValid = bValid && isNotEmpty(subviewPath);