diff --git a/ChangeLog b/ChangeLog index 2aa182777..1e5b62636 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-06-05 Marc Delisle + * libraries/functions.js: bug #1207405, invalid SQL when creating + table with zero fields + 2005-06-05 Michal Čihař * lang/czech: Update. diff --git a/libraries/functions.js b/libraries/functions.js index 0bc6c716c..8a1805723 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -218,7 +218,7 @@ function checkSqlQuery(theForm) /** - * Displays an error message if an element of a form hasn't been completed and + * Check if a form's element is empty * should be * * @param object the form @@ -226,7 +226,7 @@ function checkSqlQuery(theForm) * * @return boolean whether the form field is empty or not */ -function emptyFormElements(theForm, theFieldName) +function emptyCheckTheField(theForm, theFieldName) { var isEmpty = 1; var theField = theForm.elements[theFieldName]; @@ -239,6 +239,25 @@ function emptyFormElements(theForm, theFieldName) var space_re = new RegExp('\\s+'); isEmpty = (theField.value.replace(space_re, '') == '') ? 1 : 0; } + + return isEmpty; +} // end of the 'emptyCheckTheField()' function + + +/** + * Displays an error message if an element of a form hasn't been completed and + * should be + * + * @param object the form + * @param string the name of the form field to put the focus on + * + * @return boolean whether the form field is empty or not + */ +function emptyFormElements(theForm, theFieldName) +{ + var theField = theForm.elements[theFieldName]; + isEmpty = emptyCheckTheField(theForm, theFieldName); + if (isEmpty) { theForm.reset(); theField.select(); @@ -291,12 +310,18 @@ function checkFormElementInRange(theForm, theFieldName, min, max) else { theField.value = val; } - return true; + } // end of the 'checkFormElementInRange()' function + function checkTableEditForm(theForm, fieldsCnt) { + // TODO: avoid sending a message if user just wants to add a line + // on the form but has not completed at least one field name + + var atLeastOneField = 0; + for (i=0; i