From 41708e5f17c87fa7fc329074e55021a5e1422d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 28 Apr 2016 20:57:37 +0200 Subject: [PATCH] Prevent submit of UniqueDialog - trigger the first primary button on submit - put the focus on the first input/select issue5520 review16191002 --- src/common.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common.js b/src/common.js index 77565674b1..276a16b70d 100644 --- a/src/common.js +++ b/src/common.js @@ -2579,8 +2579,16 @@ var prm = jQuery.Deferred(); args.push(prm); var dialog = this.build_dialog.apply(this, args); + dialog.content.submit(function(evt) { + dialog.footer.find('button.btn-primary').first().click(); + evt.preventDefault(); + }.bind(this)); this.running = true; dialog.modal.modal('show'); + dialog.modal.on('shown.bs.modal', function() { + dialog.modal.find('input,select') + .filter(':visible').first().focus(); + }); return prm; }, close: function(dialog) {