Commit 18c85d08 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Merge branch 'return_keysubmits' into raos_work

parents 12e61622 f426615c
......@@ -66,7 +66,11 @@ var QfqNS = QfqNS || {};
this.getDeleteButton().click(this.handleDeleteClick.bind(this));
this.setupFormUpdateHandler();
this.setupEnterKeyHandler();
if (!!$('#' + QfqNS.escapeJqueryIdSelector(this.formId)).data('disable-return-key-submit')) {
// Nothing to do
} else {
this.setupEnterKeyHandler();
}
this.fileUploader = new n.FileUpload('#' + this.formId, this.fileUploadTo);
this.fileUploader.on('fileupload.started', this.startUploadHandler);
......@@ -128,7 +132,7 @@ var QfqNS = QfqNS || {};
*/
n.QfqForm.prototype.setupEnterKeyHandler = function () {
$("input").keyup(function (event) {
if (event.which === 13) {
if (event.which === 13 && this.submitOnEnter()) {
if (this.form.formChanged) {
this.lastButtonPress = "save&close";
n.Log.debug("save&close click");
......@@ -876,4 +880,11 @@ var QfqNS = QfqNS || {};
return this.form.formChanged;
};
/**
* @private
*/
n.QfqForm.prototype.submitOnEnter = function () {
return !(!!this.form.$form.data('disable-return-key-submit'));
};
})(QfqNS);
\ No newline at end of file
......@@ -111,7 +111,8 @@
</div>
<form id="myForm" class="form-horizontal" data-toggle="validator" data-enable-save-button="false">
<form id="myForm" class="form-horizontal" data-toggle="validator" data-enable-save-button="false"
data-disable-return-key-submit="false">
<input type="hidden" name="s" value="badcaffee1234">
<div class="tab-content">
......
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