Bug #3187422 Form validation and submission
This commit is contained in:
@@ -1738,7 +1738,7 @@ $(document).ready(function() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// .live() must be called after a selector, see http://api.jquery.com/live
|
// .live() must be called after a selector, see http://api.jquery.com/live
|
||||||
$("#create_table_form.ajax input[name=do_save_data]").live('click', function(event) {
|
$("#create_table_form input[name=do_save_data]").live('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1746,6 +1746,17 @@ $(document).ready(function() {
|
|||||||
*/
|
*/
|
||||||
var $form = $("#create_table_form");
|
var $form = $("#create_table_form");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* First validate the form; if there is a problem, avoid submitting it
|
||||||
|
*
|
||||||
|
* checkTableEditForm() needs a pure element and not a jQuery object,
|
||||||
|
* this is why we pass $form[0] as a parameter (the jQuery object
|
||||||
|
* is actually an array of DOM elements)
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) {
|
||||||
|
// OK, form passed validation step
|
||||||
|
if ($form.hasClass('ajax')) {
|
||||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||||
if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
|
if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
|
||||||
$form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
|
$form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
|
||||||
@@ -1806,11 +1817,17 @@ $(document).ready(function() {
|
|||||||
if (window.parent && window.parent.frame_navigation) {
|
if (window.parent && window.parent.frame_navigation) {
|
||||||
window.parent.frame_navigation.location.reload();
|
window.parent.frame_navigation.location.reload();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$('#properties_message').html(data.error);
|
$('#properties_message').html(data.error);
|
||||||
}
|
}
|
||||||
}) // end $.post()
|
}) // end $.post()
|
||||||
|
} // end if ($form.hasClass('ajax')
|
||||||
|
else {
|
||||||
|
// non-Ajax submit
|
||||||
|
$form.append('<input type="hidden" name="do_save_data" value="save" />');
|
||||||
|
$form.submit();
|
||||||
|
}
|
||||||
|
} // end if (checkTableEditForm() )
|
||||||
}) // end create table form (save)
|
}) // end create table form (save)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -774,8 +774,7 @@ if ($action == 'tbl_create.php') {
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<fieldset class="tblFooters">
|
<fieldset class="tblFooters">
|
||||||
<input type="submit" name="do_save_data" value="<?php echo __('Save'); ?>"
|
<input type="submit" name="do_save_data" value="<?php echo __('Save'); ?>" />
|
||||||
onclick="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" />
|
|
||||||
<?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?>
|
<?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?>
|
||||||
<?php echo __('Or'); ?>
|
<?php echo __('Or'); ?>
|
||||||
<?php echo sprintf(__('Add %s column(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?>
|
<?php echo sprintf(__('Add %s column(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?>
|
||||||
|
Reference in New Issue
Block a user