Commit af102b4b authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fix a bug when testing a file size with type browsefile

parent bc21dc68
......@@ -104,7 +104,11 @@ jQuery.validator.addMethod("exclude_required", function(value, element, options)
}, jQuery.format("Please fill one and only one of these fields."));
jQuery.validator.addMethod("maxfilesize", function(value, element, params) {
return this.optional(element) || $(element).data("data2upload").files[0].size < params[0];
if (params[0] != 0) {
return this.optional(element) || $(element).data("data2upload").files[0].size < params[0];
} else {
return true;
}
}, jQuery.format("Selected file exceeds size limits: {1}"));
jQuery.validator.addMethod("multinumber", function(value, element, params) {
......@@ -655,12 +659,20 @@ jQuery.validator.addMethod("mparam", function(value, element, params) {
' {{each(index, param) workflow.parameters_per_groups[group]}}',
// if param is an inputfile or just a browsefile
' {{if param.type.indexOf("inputfile") === 0 || param.type.indexOf("browsefile") === 0}}',
' {{if param.action == "append"}}',
' <input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" multiple type="file">',
' {{else}}',
' <input name="browse_${param.name}" id="browse_${param.name}" class="fileupload" type="file">',
' {{/if}}',
// if it's a multiple type
' {{else param.type == "MultipleParameters"}}',
' {{each(spindex, sub_param) param.sub_parameters}}',
' {{if sub_param.type.indexOf("inputfile") === 0 || sub_param.type.indexOf("browsefile") === 0}}',
' <input name="browse_${sub_param.name}" id="browse_${sub_param.name}" class="fileupload" type="file">',
' {{if param.action == "append"}}',
' <input name="browse_${sub_param.name}" id="browse_${sub_param.name}" multiple class="fileupload" type="file">',
' {{else}}',
' <input name="browse_${sub_param.name}" id="browse_${sub_param.name}" class="fileupload" type="file">',
' {{/if}}',
' {{/if}}',
' {{/each}}',
' {{/if}}',
......
Supports Markdown
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