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