Commit 5118391b authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge remote-tracking branch 'origin/raos_work' into Typo3integrated

parents 7a01f6c7 1f95b485
......@@ -18,6 +18,7 @@ if (!QfqNS) {
this.form = new n.Form(this.formId);
this.bsTabs = null;
this.lastButtonPress = null;
this.destroyFormUserCallbacks = new n.Helper.FunctionList();
this.getSaveButton().addClass("disabled").attr("disabled", "disabled");
......@@ -36,6 +37,36 @@ if (!QfqNS) {
this.bsTabs = bsTabs;
};
/**
*
* @param $button
* @param enabled {boolean}
*
* @private
*/
n.QfqForm.prototype.setButtonEnabled = function ($button, enabled) {
if (!$button) {
n.Log.error("QfqForm#setButtonEnabled(): no button provided.");
return;
}
if (!enabled) {
$button.addClass("disabled");
$button.attr("disabled", "disabled");
} else {
$button.removeClass("disabled");
$button.removeAttr("disabled");
}
};
/**
* @private
*/
n.QfqForm.prototype.destroyFormAndSetText = function (text) {
this.form = null;
$('#' + this.formId).replaceWith($("<p>").append(text));
this.destroyFormUserCallbacks.call();
};
/**
* @private
*/
......@@ -124,6 +155,12 @@ if (!QfqNS) {
* @private
*/
n.QfqForm.prototype.handleDeleteSuccess = function (data) {
this.setButtonEnabled(this.getCloseButton(), false);
this.setButtonEnabled(this.getDeleteButton(), false);
this.setButtonEnabled(this.getSaveButton(), false);
this.setButtonEnabled(this.getNewButton(), false);
this.destroyFormAndSetText("Record has been deleted!");
if (!data.redirect || data.redirect === "client") {
window.history.back();
return;
......
......@@ -45,12 +45,21 @@ if (!QfqNS) {
try {
this.qfqForm = new QfqNS.QfqForm(this.settings.formId, this.settings.submitTo, this.settings.deleteUrl);
this.qfqForm.setBsTabs(this.bsTabs);
this.qfqForm.destroyFormUserCallbacks.addFunction(this.destroyFormHandler.bind(this));
} catch (e) {
QfqNS.Log.error(e.message);
this.qfqForm = null;
}
};
/**
* @private
*/
n.QfqPage.prototype.destroyFormHandler = function () {
this.settings.qfqForm = null;
$('#' + this.settings.tabsId).remove();
};
n.QfqPage.prototype.tabShowHandler = function (bsTabs) {
// tabShowHandler will be called every time the tab will be shown, regardless of whether or not this happens
// because of BSTabs.activateTab() or user interaction.
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Post Target</title>
</head>
<body>
<p>Form submitted</p>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Submit Form</title>
</head>
<body>
<form action="posttarget.html">
<input type="text" name="input a">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
\ No newline at end of file
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