# HG changeset patch # User Adrien Di Mascio # Date 1275583502 -7200 # Node ID 1b5d9ec38c1b129e48be8e6decbfd7a5075a1e52 # Parent 785837baabba694f022950074b064c2ece340bb5 [javascript] refactor execution flow of handleFormValidationResponse so that location hash is set to #header whatever the error is diff -r 785837baabba -r 1b5d9ec38c1b 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;