diff --git a/ChangeLog b/ChangeLog index f2015294d..aae2ca0f0 100755 --- a/ChangeLog +++ b/ChangeLog @@ -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çois . 2001-08-18 Robin Johnson * lib.inc.php3 (788, 790) : tweak size for lower resolution screens. diff --git a/functions.js b/functions.js index 8dd912601..355a6d299 100755 --- a/functions.js +++ b/functions.js @@ -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();