From 007bb0b607af05b49b9708f9cfda384167f8604d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 19 Aug 2001 15:57:56 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20bug=20#450255=20(new=20javascript=20err?= =?UTF-8?q?or=20with=20netscape3)=20thanks=20to=20Fran=EF=BF=BDois?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 2 ++ functions.js | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) 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();