Commit a1fe0d62 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team

browser/js/{database,form_builder}.js, views/partial/file/form.html: File fields are required

But this need to be updated (Javascript side) when switching configuration.

See #3907
parent e231e071
...@@ -372,8 +372,14 @@ Database.prototype = { ...@@ -372,8 +372,14 @@ Database.prototype = {
if ($option.attr('required_files') == "1"){ if ($option.attr('required_files') == "1"){
$(".file_2").hide(); $(".file_2").hide();
$(".upload_file").val(""); $(".upload_file").val("");
$(".upload_field").each(function() {
$(this).prop("required", false);
});
}else{ }else{
$(".file_2").show(); $(".file_2").show();
$(".upload_field").each(function() {
$(this).prop("required", true);
});
} }
}, },
......
...@@ -351,6 +351,8 @@ FileFormBuilder.prototype.build_file_field = function(id, hidden) { ...@@ -351,6 +351,8 @@ FileFormBuilder.prototype.build_file_field = function(id, hidden) {
var i = this.build_input('upload_' + id, 'upload_field', 'file'+id, 'file', 'file'); var i = this.build_input('upload_' + id, 'upload_field', 'file'+id, 'file', 'file');
if (this.source) { if (this.source) {
i.disabled = true; i.disabled = true;
} else {
i.required = true;
} }
i.title = "(.fa, .fastq, .fa.gz, .fastq.gz, .clntab)"; i.title = "(.fa, .fastq, .fa.gz, .fastq.gz, .clntab)";
d.appendChild(i); d.appendChild(i);
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
<input class="upload_field form-control" id="file_upload_1_{{=i}}" type="file" <input class="upload_field form-control" id="file_upload_1_{{=i}}" type="file"
{{if network_source:}} {{if network_source:}}
disabled disabled
{{else:}}
required
{{pass}} {{pass}}
onchange="db.upload_file_onChange('file_filename_{{=i}}', this.value)" onchange="db.upload_file_onChange('file_filename_{{=i}}', this.value)"
title="first file for this sample (.fa, .fastq, .fa.gz, .fastq.gz, .clntab)" title="first file for this sample (.fa, .fastq, .fa.gz, .fastq.gz, .clntab)"
...@@ -28,6 +30,8 @@ ...@@ -28,6 +30,8 @@
<input class="upload_field form-control" id="file_upload_2_{{=i}}" type="file" <input class="upload_field form-control" id="file_upload_2_{{=i}}" type="file"
{{if network_source:}} {{if network_source:}}
disabled disabled
{{else:}}
required
{{pass}} {{pass}}
title="second file for this sample (.fa, .fastq, .fa.gz, .fastq.gz)" title="second file for this sample (.fa, .fastq, .fa.gz, .fastq.gz)"
> >
......
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