This commit is contained in:
opi 2016-07-12 13:51:51 +00:00 committed by GitHub
commit 47b319a778
3 changed files with 20 additions and 3 deletions

View file

@ -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'] === "") {

View file

@ -43,11 +43,11 @@
<div class="col-sm-12"> <div class="col-sm-12">
{{#if choices}} {{#if choices}}
<select id="{{name}}" name="{{name}}" required class="form-control" {{attributes}}> <select id="{{name}}" name="{{name}}" required class="form-control" {{{attributes}}}>
{{#choices}}<option value="{{value}}" {{#if selected}}selected{{/if}}>{{label}}</option>{{/choices}} {{#choices}}<option value="{{value}}" {{#if selected}}selected{{/if}}>{{label}}</option>{{/choices}}
</select> </select>
{{else}} {{else}}
<input type="{{inputType}}" id="{{name}}" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" {{required}} {{attributes}}> <input type="{{inputType}}" id="{{name}}" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" {{required}} {{{attributes}}}>
{{/if}} {{/if}}
{{#if help}} {{#if help}}

View file

@ -52,7 +52,7 @@
<div class="container"> <div class="container">
<p>{{t 'domain_dns_longdesc'}}</p> <p>{{t 'domain_dns_longdesc'}}</p>
<a href="#/domains/{{name}}/dns" class="btn btn-default slide"> <a href="#/domains/{{name}}/dns" class="btn btn-default slide">
<span class="fa-fw fa-globe"></span> {{t 'domain_dns_config'}} {{t 'domain_dns_config'}} <span class="fa-fw fa-globe"></span>
</a> </a>
</div> </div>
<hr> <hr>