Skip to content

Instantly share code, notes, and snippets.

@aanchalsikka

aanchalsikka/form.js

Last active Mar 24, 2018
Embed
What would you like to do?
Checkbox for schema editor
var allCheckbox = $('[data-metatype=checkbox]', $form);
allCheckbox.each(function (index, checkbox) {
var $checkbox = $(checkbox);
if($checkbox.is(":checked")){
$checkbox.attr('value','true');
}
// Add false to checkbox if asset is not opened in bulk metadata editor
// see https://jira.corp.adobe.com/browse/CQ-98699 for details .
// in bulk metadata editor only checked state is considered.
else if(!($(".foundation-collection").data("foundation-selections-mode")=="multiple")){
$checkbox.attr('value','false');
}
var typeHint = $checkbox.data('typehint');
if (!typeHint) {
typeHint = 'Boolean';
}
var name = $checkbox.attr('name');
hintFields.push({
'name': name + '@TypeHint',
'value': typeHint
});
});
var allMetatypeCheckbox = $('coral-checkbox[data-metatype=checkbox]', $form);
allMetatypeCheckbox.each(function (index, coralCheckbox) {
var $coralCheckbox = $(coralCheckbox);
var $checkbox = $coralCheckbox.find("input[type='checkbox']");
if($checkbox){
if($checkbox.is(":checked")){
$checkbox.attr('value','true');
}
// Add false to checkbox if asset is not opened in bulk metadata editor
// see https://jira.corp.adobe.com/browse/CQ-98699 for details .
// in bulk metadata editor only checked state is considered.
else if(!($(".foundation-collection").data("foundation-selections-mode")=="multiple")){
$checkbox.attr('value','false');
}
var typeHint = $checkbox.data('typehint');
if (!typeHint) {
typeHint = 'Boolean';
}
var name = $checkbox.attr('name');
hintFields.push({
'name': name + '@TypeHint',
'value': typeHint
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.