From f402f308b875256891f366a401f0cf43bac4771d Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Tue, 27 Mar 2012 14:04:17 +0200 Subject: [PATCH] Allow ajax create-table form only once, autofocus table name input --- js/functions.js | 9 +++++++++ libraries/tbl_properties.inc.php | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/js/functions.js b/js/functions.js index d8c30bcbc8..938b43aa66 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1371,6 +1371,12 @@ function PMA_createTableDialog( $div, url , target) $(this).closest('.ui-dialog-content').dialog('close').remove(); }; + // allow create-table form only once + if ($('#create_table_form').length) { + $('#create_table_form input[autofocus]').focus(); + return; + } + var $msgbox = PMA_ajaxShowMessage(); $.get( target , url , function(data) { @@ -1431,6 +1437,9 @@ function PMA_createTableDialog( $div, url , target) var $save_button = $('#create_table_form').find("input[name='do_save_data']"); $cancel_button.insertAfter($save_button); $button_pane.hide(); + + // focus table name input + $(this).find("input[autofocus]").focus(); }, close: function() { $(window).unbind('resize.dialog-resizer'); diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 8a30f2ef32..fc77a913f5 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -563,10 +563,10 @@ echo PMA_generate_common_hidden_inputs($_form_params); unset($_form_params); if ($action == 'tbl_create.php') { ?> - +
+ class="textfield" autofocus />