Fixed bug #450255 (new javascript error with netscape3) thanks to Fran�ois

This commit is contained in:
Loïc Chapeaux
2001-08-19 15:57:56 +00:00
parent 2f91f66172
commit 007bb0b607
2 changed files with 12 additions and 8 deletions

View File

@@ -35,6 +35,8 @@ $Source$
* lib.inc.php3, lines 196-200; config.inc.php3, line 40;
Documentation.html, lines 352-357: merged patch #452877
($cfgServer['only_db'] - array) from Jakub Wilk.
* functions.js: fixed bug #450255 (new javascript error with netscape3)
thanks to Fran<61>ois <outils@altern.org>.
2001-08-18 Robin Johnson <robbat2@orbis-terrarum.net>
* lib.inc.php3 (788, 790) : tweak size for lower resolution screens.

View File

@@ -16,22 +16,23 @@ function emptySqlQuery(theForm)
// The replace function (js1.2) isn't supported -> basic tests
if (!isRegExp) {
var isEmpty = (sqlQuery1.value == '') ? 1 : 0;
var isEmpty = (sqlQuery1.value == '') ? 1 : 0;
if (isEmpty && typeof(theForm.elements['sql_file']) != 'undefined') {
isEmpty = (theForm.elements['sql_file'].value == '') ? 1 : 0;
isEmpty = (theForm.elements['sql_file'].value == '') ? 1 : 0;
}
if (isEmpty && typeof(theForm.elements['id_bookmark']) != 'undefined') {
isEmpty = (theForm.elements['id_bookmark'].value == '') ? 1 : 0;
isEmpty = (theForm.elements['id_bookmark'].value == '') ? 1 : 0;
}
}
// js1.2+ -> validation with regular expressions
else {
var isEmpty = (sqlQuery1.value.replace(/\s/g, '') == '') ? 1 : 0;
var space_re = new RegExp('\\s+');
var isEmpty = (sqlQuery1.value.replace(space_re, '') == '') ? 1 : 0;
if (isEmpty && typeof(theForm.elements['sql_file']) != 'undefined') {
isEmpty = (theForm.elements['sql_file'].value.replace(/\s/g, '') == '') ? 1 : 0;
isEmpty = (theForm.elements['sql_file'].value.replace(space_re, '') == '') ? 1 : 0;
}
if (isEmpty && typeof(theForm.elements['id_bookmark']) != 'undefined') {
isEmpty = (theForm.elements['id_bookmark'].value == '') ? 1 : 0;
isEmpty = (theForm.elements['id_bookmark'].value == '') ? 1 : 0;
}
if (isEmpty) {
theForm.reset();
@@ -65,9 +66,10 @@ function emptyFormElements(theForm, theFieldName)
var isRegExp = (typeof(theField.value.replace) != 'undefined');
if (!isRegExp) {
var isEmpty = (theField.value == '') ? 1 : 0;
var isEmpty = (theField.value == '') ? 1 : 0;
} else {
var isEmpty = (theField.value.replace(/\s/g, '') == '') ? 1 : 0;
var space_re = new RegExp('\\s+');
var isEmpty = (theField.value.replace(space_re, '') == '') ? 1 : 0;
}
if (isEmpty) {
theForm.reset();