to avoid undefined attribute errors, give different ids to the create table form and add fields form; then use the .live() method directly after a selector as recommended
This commit is contained in:
@@ -2035,17 +2035,15 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for submission of create table form
|
||||
* Attach event handler for submission of create table form (save)
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses $.PMA_sort_table()
|
||||
* @uses window.parent.refreshNavigation()
|
||||
*
|
||||
* The create_table_form whose action is tbl_create.php is the
|
||||
* one which is ajaxified; in this form the action could be
|
||||
* tbl_addfield.php but it's not ajaxified yet.
|
||||
*/
|
||||
$("#create_table_form").attr('action').is('tbl_create.php').find("input[name=submit_num_fields], input[name=do_save_data]").live('click', function(event) {
|
||||
// .live() must be called after a selector, see http://api.jquery.com/live
|
||||
$("#create_table_form input[name=do_save_data]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
/**
|
||||
@@ -2055,14 +2053,6 @@ $(document).ready(function() {
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$(the_form).append('<input type="hidden" name="ajax_request" value="true" />');
|
||||
|
||||
if($(this).attr('name') == 'submit_num_fields') {
|
||||
//User wants to add more fields to the table
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
|
||||
$("#create_table_dialog").html(data);
|
||||
}) //end $.post()
|
||||
}
|
||||
else if($(this).attr('name') == 'do_save_data') {
|
||||
//User wants to submit the form
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&do_save_data=" + $(this).val(), function(data) {
|
||||
if(data.success == true) {
|
||||
@@ -2112,8 +2102,34 @@ $(document).ready(function() {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}) // end $.post()
|
||||
} // end elseif()
|
||||
}) // end create table form submit button actions
|
||||
}) // end create table form (save)
|
||||
|
||||
/**
|
||||
* Attach event handler for create table form (add fields)
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses $.PMA_sort_table()
|
||||
* @uses window.parent.refreshNavigation()
|
||||
*
|
||||
*/
|
||||
// .live() must be called after a selector, see http://api.jquery.com/live
|
||||
$("#create_table_form input[name=submit_num_fields]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
/**
|
||||
* @var the_form object referring to the create table form
|
||||
*/
|
||||
var the_form = $("#create_table_form");
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$(the_form).append('<input type="hidden" name="ajax_request" value="true" />');
|
||||
|
||||
//User wants to add more fields to the table
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
|
||||
$("#create_table_dialog").html(data);
|
||||
}) //end $.post()
|
||||
|
||||
}) // end create table form (add fields)
|
||||
|
||||
}, 'top.frame_content'); //end $(document).ready for 'Create Table'
|
||||
|
||||
|
@@ -610,7 +610,7 @@ document.onkeydown = onKeyDownArrowsHandler;
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="create_table_form" method="post" action="<?php echo $action; ?>">
|
||||
<form id="<?php echo ($action == 'tbl_create.php' ? 'create_table' : 'append_fields'); ?>_form" method="post" action="<?php echo $action; ?>">
|
||||
<?php
|
||||
echo PMA_generate_common_hidden_inputs($_form_params);
|
||||
unset($_form_params);
|
||||
|
Reference in New Issue
Block a user