Bug # 3170585 [AJAX] Adding more fields fails.

This commit is contained in:
Madhura Jayaratne
2011-02-03 00:51:58 +05:30
parent 3a3f6d5141
commit 3e4e3fb4d6
2 changed files with 20 additions and 3 deletions

View File

@@ -1845,7 +1845,14 @@ $(document).ready(function() {
//User wants to add more fields to the table //User wants to add more fields to the table
$.post($form.attr('action'), $form.serialize() + "&submit_num_fields=" + $(this).val(), function(data) { $.post($form.attr('action'), $form.serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
$("#create_table_dialog").html(data); // if 'create_table_dialog' exists
if ($("#create_table_dialog").length > 0) {
$("#create_table_dialog").html(data);
}
// if 'create_table_div' exists
if ($("#create_table_div").length > 0) {
$("#create_table_div").html(data);
}
}) //end $.post() }) //end $.post()
}) // end create table form (add fields) }) // end create table form (add fields)

View File

@@ -288,7 +288,7 @@ if (isset($_REQUEST['do_save_data'])) {
$new_table_string .= '<th>'; $new_table_string .= '<th>';
$new_table_string .= '<a href="sql.php' . PMA_generate_common_url($tbl_url_params) . '">'. $table . '</a>'; $new_table_string .= '<a href="sql.php' . PMA_generate_common_url($tbl_url_params) . '">'. $table . '</a>';
if (PMA_Tracker::isActive()) { if (PMA_Tracker::isActive()) {
$truename = str_replace(' ', '&nbsp;', htmlspecialchars($table)); $truename = str_replace(' ', '&nbsp;', htmlspecialchars($table));
if (PMA_Tracker::isTracked($db, $truename)) { if (PMA_Tracker::isTracked($db, $truename)) {
@@ -313,7 +313,7 @@ if (isset($_REQUEST['do_save_data'])) {
$new_table_string .= '<td><a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&amp;sql_query='; $new_table_string .= '<td><a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&amp;sql_query=';
$new_table_string .= urlencode('DROP TABLE ' . PMA_backquote($table)); $new_table_string .= urlencode('DROP TABLE ' . PMA_backquote($table));
$new_table_string .= '">'; $new_table_string .= '">';
$new_table_string .= $titles['Drop']; $new_table_string .= $titles['Drop'];
$new_table_string .= '</a></td>' . "\n"; $new_table_string .= '</a></td>' . "\n";
$new_table_string .= '<td class="value">' . $tbl_stats['Rows'] . '</td>' . "\n"; $new_table_string .= '<td class="value">' . $tbl_stats['Rows'] . '</td>' . "\n";
@@ -362,7 +362,17 @@ if (isset($_REQUEST['do_save_data'])) {
/** /**
* Displays the form used to define the structure of the table * Displays the form used to define the structure of the table
*/ */
// This div is used to show the content(eg: create table form with more columns) fetched with AJAX subsequently.
if($GLOBALS['is_ajax_request'] != true) {
echo('<div id="create_table_div">');
}
require './libraries/tbl_properties.inc.php'; require './libraries/tbl_properties.inc.php';
// Displays the footer // Displays the footer
require './libraries/footer.inc.php'; require './libraries/footer.inc.php';
if($GLOBALS['is_ajax_request'] != true) {
echo('</div>');
}
?> ?>