bug #1207405, invalid SQL when creating table with zero fields
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2005-06-05 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
|
* libraries/functions.js: bug #1207405, invalid SQL when creating
|
||||||
|
table with zero fields
|
||||||
|
|
||||||
2005-06-05 Michal Čihař <michal@cihar.com>
|
2005-06-05 Michal Čihař <michal@cihar.com>
|
||||||
* lang/czech: Update.
|
* lang/czech: Update.
|
||||||
|
|
||||||
|
@@ -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
|
* should be
|
||||||
*
|
*
|
||||||
* @param object the form
|
* @param object the form
|
||||||
@@ -226,7 +226,7 @@ function checkSqlQuery(theForm)
|
|||||||
*
|
*
|
||||||
* @return boolean whether the form field is empty or not
|
* @return boolean whether the form field is empty or not
|
||||||
*/
|
*/
|
||||||
function emptyFormElements(theForm, theFieldName)
|
function emptyCheckTheField(theForm, theFieldName)
|
||||||
{
|
{
|
||||||
var isEmpty = 1;
|
var isEmpty = 1;
|
||||||
var theField = theForm.elements[theFieldName];
|
var theField = theForm.elements[theFieldName];
|
||||||
@@ -239,6 +239,25 @@ function emptyFormElements(theForm, theFieldName)
|
|||||||
var space_re = new RegExp('\\s+');
|
var space_re = new RegExp('\\s+');
|
||||||
isEmpty = (theField.value.replace(space_re, '') == '') ? 1 : 0;
|
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) {
|
if (isEmpty) {
|
||||||
theForm.reset();
|
theForm.reset();
|
||||||
theField.select();
|
theField.select();
|
||||||
@@ -291,12 +310,18 @@ function checkFormElementInRange(theForm, theFieldName, min, max)
|
|||||||
else {
|
else {
|
||||||
theField.value = val;
|
theField.value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} // end of the 'checkFormElementInRange()' function
|
} // end of the 'checkFormElementInRange()' function
|
||||||
|
|
||||||
|
|
||||||
function checkTableEditForm(theForm, fieldsCnt)
|
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<fieldsCnt; i++)
|
for (i=0; i<fieldsCnt; i++)
|
||||||
{
|
{
|
||||||
var id = "field_" + i + "_2";
|
var id = "field_" + i + "_2";
|
||||||
@@ -312,7 +337,21 @@ function checkTableEditForm(theForm, fieldsCnt)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (atLeastOneField == 0) {
|
||||||
|
var id = "field_" + i + "_1";
|
||||||
|
if (!emptyCheckTheField(theForm, id)) {
|
||||||
|
atLeastOneField = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (atLeastOneField == 0) {
|
||||||
|
var theField = theForm.elements["field_0_1"];
|
||||||
|
alert(errorMsg0);
|
||||||
|
theField.focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // enf of the 'checkTableEditForm()' function
|
} // enf of the 'checkTableEditForm()' function
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user