[javascript] refactor execution flow of handleFormValidationResponse so that location hash is set to #header whatever the error is
--- 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;