Commit 6e527318 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Instantiation of FileUpload moved from QfqPage to QfqForm.

parent 743a5b1f
......@@ -11,12 +11,14 @@ if (!QfqNS) {
(function (n) {
'use strict';
n.QfqForm = function (formId, submitTo, deleteUrl, dataRefreshUrl) {
n.QfqForm = function (formId, submitTo, deleteUrl, dataRefreshUrl, fileUploadTo) {
this.formId = formId;
this.submitTo = submitTo;
this.deleteUrl = deleteUrl;
this.dataRefreshUrl = dataRefreshUrl;
this.fileUploadTo = fileUploadTo;
this.form = new n.Form(this.formId);
// This is required when displaying validation messages, in to activate the tab, which has validation issues
this.bsTabs = null;
this.lastButtonPress = null;
this.destroyFormUserCallbacks = new n.Helper.FunctionList();
......@@ -34,6 +36,8 @@ if (!QfqNS) {
this.getDeleteButton().click(this.handleDeleteClick.bind(this));
this.setupFormUpdateHandler();
this.fileUploader = new QfqNS.FileUpload('#' + this.formId, this.fileUploadTo, this.getSip());
};
n.QfqForm.prototype.setBsTabs = function (bsTabs) {
......
......@@ -49,23 +49,14 @@ if (!QfqNS) {
this.settings.formId,
this.settings.submitTo,
this.settings.deleteUrl,
this.settings.refreshUrl);
this.settings.refreshUrl,
this.settings.fileUploadTo);
this.qfqForm.setBsTabs(this.bsTabs);
this.qfqForm.destroyFormUserCallbacks.addFunction(this.destroyFormHandler.bind(this));
} catch (e) {
QfqNS.Log.error(e.message);
this.qfqForm = null;
}
try {
if (this.qfqForm) {
var sip = this.qfqForm.getSip();
this.fileUploader = new QfqNS.FileUpload('#' + this.settings.formId, this.settings.fileUploadTo, sip);
}
} catch (e) {
QfqNS.Log.error(e.message);
this.fileUploader = null;
}
};
/**
......
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