Allow ajax create-table form only once, autofocus table name input

This commit is contained in:
Jo Michael 2012-03-27 14:04:17 +02:00
parent 54cffa0959
commit f402f308b8
2 changed files with 11 additions and 2 deletions

View File

@ -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');

View File

@ -563,10 +563,10 @@ echo PMA_generate_common_hidden_inputs($_form_params);
unset($_form_params);
if ($action == 'tbl_create.php') {
?>
<table>
<table class="table-name">
<tr><td><?php echo __('Table name'); ?>:&nbsp;<input type="text" name="table" size="40" maxlength="80"
value="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
class="textfield" />
class="textfield" autofocus />
</td>
<td>
<?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?>