fix choose option

This commit is contained in:
aynsix
2022-01-06 18:38:47 +03:00
parent c4c6cb25c3
commit 1d3f9a73be
2 changed files with 15 additions and 0 deletions

View File

@@ -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');

View File

@@ -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);