2016-02-02 17:28:30 +00:00
|
|
|
(function(Modules) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
Modules.FileUpload = function() {
|
|
|
|
|
|
2016-02-22 12:16:19 +00:00
|
|
|
let $field;
|
2016-02-02 17:28:30 +00:00
|
|
|
|
2016-02-22 12:16:19 +00:00
|
|
|
this.submit = function() {
|
2016-02-02 17:28:30 +00:00
|
|
|
|
2016-02-22 12:16:19 +00:00
|
|
|
$field.parents('form').trigger('submit');
|
2016-02-02 17:28:30 +00:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.start = function(component) {
|
|
|
|
|
|
|
|
|
|
$field = $('.file-upload-field', component);
|
|
|
|
|
|
|
|
|
|
// Need to put the event on the container, not the input for it to work properly
|
2016-02-22 12:16:19 +00:00
|
|
|
$(component).on('change', '.file-upload-field', this.submit);
|
2016-02-02 17:28:30 +00:00
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
})(window.GOVUK.Modules);
|