Prevent submit of UniqueDialog

- trigger the first primary button on submit
- put the focus on the first input/select

issue5520
review16191002
This commit is contained in:
C?dric Krier 2016-04-28 20:57:37 +02:00
parent e0b76ceabe
commit c16ad30dba

View file

@ -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) {