mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[fix] Allow checkbox to be unchecked even if default is true.
This commit is contained in:
parent
ce2bff086e
commit
ab523a2ddd
1 changed files with 17 additions and 0 deletions
|
@ -170,6 +170,14 @@
|
||||||
|
|
||||||
// Checkbox should not be required to be unchecked
|
// Checkbox should not be required to be unchecked
|
||||||
data.manifest.arguments.install[k].required = '';
|
data.manifest.arguments.install[k].required = '';
|
||||||
|
|
||||||
|
// Clone a hidden input with empty value
|
||||||
|
// https://stackoverflow.com/questions/476426/submit-an-html-form-with-empty-checkboxes
|
||||||
|
inputClone = {};
|
||||||
|
inputClone.name = data.manifest.arguments.install[k].name;
|
||||||
|
inputClone.inputType = 'hidden';
|
||||||
|
inputClone.default = 0;
|
||||||
|
data.manifest.arguments.install.push(inputClone);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'password' type input.
|
// 'password' type input.
|
||||||
|
@ -221,6 +229,15 @@
|
||||||
params = { 'label': c.params['label'], 'app': c.params['app'] };
|
params = { 'label': c.params['label'], 'app': c.params['app'] };
|
||||||
delete c.params['label'];
|
delete c.params['label'];
|
||||||
delete c.params['app'];
|
delete c.params['app'];
|
||||||
|
|
||||||
|
// Check for duplicate arg produced by empty checkbox. (See inputClone)
|
||||||
|
$.each(c.params, function(k, v) {
|
||||||
|
if (typeof(v) === 'object' && Array.isArray(v)) {
|
||||||
|
// And return only first value
|
||||||
|
c.params[k] = v[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
params['args'] = c.serialize(c.params.toHash());
|
params['args'] = c.serialize(c.params.toHash());
|
||||||
// Do not pass empty args.
|
// Do not pass empty args.
|
||||||
if (params['args'] === "") {
|
if (params['args'] === "") {
|
||||||
|
|
Loading…
Add table
Reference in a new issue