Commit 4b1efd1e authored by genofire's avatar genofire Committed by JC Brand

fix ad-hoc commands checkbox

parent b1817daa
...@@ -648,11 +648,12 @@ u.xForm2webForm = function (field, stanza, options) { ...@@ -648,11 +648,12 @@ u.xForm2webForm = function (field, stanza, options) {
'required': !!field.querySelector('required') 'required': !!field.querySelector('required')
}); });
} else if (field.getAttribute('type') === 'boolean') { } else if (field.getAttribute('type') === 'boolean') {
const value = field.querySelector('value')?.textContent;
return tpl_form_checkbox({ return tpl_form_checkbox({
'id': u.getUniqueId(), 'id': u.getUniqueId(),
'name': field.getAttribute('var'), 'name': field.getAttribute('var'),
'label': field.getAttribute('label') || '', 'label': field.getAttribute('label') || '',
'checked': field.querySelector('value')?.textContent === "1" && 'checked="1"' || '', 'checked': (value === "1" || value === "true") && 'checked="1"' || '',
'required': !!field.querySelector('required') 'required': !!field.querySelector('required')
}); });
} else if (field.getAttribute('var') === 'url') { } else if (field.getAttribute('var') === 'url') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment