[javascript] refactor execution flow of handleFormValidationResponse so that location hash is set to #header whatever the error is stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 03 Jun 2010 18:45:02 +0200
branchstable
changeset 5665 1b5d9ec38c1b
parent 5662 785837baabba
child 5666 58d6c2c96500
[javascript] refactor execution flow of handleFormValidationResponse so that location hash is set to #header whatever the error is
web/data/cubicweb.edition.js
--- a/web/data/cubicweb.edition.js	Thu Jun 03 16:47:57 2010 +0200
+++ b/web/data/cubicweb.edition.js	Thu Jun 03 18:45:02 2010 +0200
@@ -395,13 +395,15 @@
     // Failures
     _clearPreviousErrors(formid);
     var descr = result[1];
+    var errmsg;
     // Unknown structure
     if ( !isArrayLike(descr) || descr.length != 2 ) {
-	updateMessage(descr);
-	return false;
+	errmsg = descr;
+    } else {
+	_displayValidationerrors(formid, descr[0], descr[1]);
+	errmsg = _('please correct errors below');
     }
-    _displayValidationerrors(formid, descr[0], descr[1]);
-    updateMessage(_('please correct errors below'));
+    updateMessage(errmsg);
     // ensure the browser does not scroll down
     document.location.hash = '#header';
     return false;