set focus on modal form
authorMaciej Tronowski <mtro@man.poznan.pl>
Tue, 21 Apr 2015 11:57:49 +0000 (13:57 +0200)
committerMaciej Tronowski <mtro@man.poznan.pl>
Tue, 21 Apr 2015 11:57:49 +0000 (13:57 +0200)
qcg/templates/qcg/gridftp.html

index 9eb5cee..12fe644 100644 (file)
@@ -54,8 +54,6 @@
 
             function conflictingName(name, modal) {
                 if (filex.files.some(function(item) { return item.get('name') == name })) {
-                    modal.find('.alert').remove();
-
                     $('<div>', {
                         'class': 'alert alert-danger',
                         html: '<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> Plik o podanej już nazwie istnieje!'
             });
 
             $('form').on('show.bs.modal', function() {
-                console.log('reset');
+                $(this).find('.alert').remove();
                 this.reset();
+            }).on('shown.bs.modal', function() {
+                $(this).find('input[type="text"]')[0].focus();
             });
 
             $('#btn-upload').on('click', function() {