From fba882204363895f34e98ab6db9e1c4bc9709807 Mon Sep 17 00:00:00 2001 From: Ariel Backenroth Date: Thu, 5 Oct 2006 06:52:27 +0000 Subject: [PATCH] putting the alert text next to the source of the error - looks absolutely horrific but more useful than what was there before. i'll work on the presentation more tomorrow. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4028 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- source/web/scripts/ajax/xforms.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/source/web/scripts/ajax/xforms.js b/source/web/scripts/ajax/xforms.js index 112890fd3a..bc46323e7d 100644 --- a/source/web/scripts/ajax/xforms.js +++ b/source/web/scripts/ajax/xforms.js @@ -48,11 +48,13 @@ dojo.declare("alfresco.xforms.Widget", { this.modified = b; this._updateDisplay(); + this.hideAlert(); }, setValid: function(b) { this.valid = b; this._updateDisplay(); + this.hideAlert(); }, setRequired: function(b) { @@ -144,6 +146,24 @@ dojo.declare("alfresco.xforms.Widget", var node = this._getAlertNode(); return node ? dojo.dom.textContent(node) : ""; }, + showAlert: function() + { + if (this.alertDiv) + return; + this.alertDiv = document.createElement("div"); + this.alertDiv.setAttribute("id", this.id + "-alert"); + this.alertDiv.appendChild(document.createTextNode(this.getAlert())); + this.domContainer.parentNode.insertBefore(this.alertDiv, this.domContainer); + this.alertDiv.setAttribute("style", "color:red; position: relative; top: 0px; left: 0px;"); + }, + hideAlert: function() + { + if (this.alertDiv) + { + dojo.dom.removeNode(this.alertDiv); + this.alertDiv = null; + } + }, _updateDisplay: function() { // this.domContainer.style.backgroundColor = @@ -1220,12 +1240,13 @@ dojo.declare("alfresco.xforms.XForm", case "xforms-submit-error": var invalid = this.rootWidget.getWidgetsInvalidForSubmit(); var msg = "Please provide values for all required fields."; - msg += "
"; _show_error(msg); break; default: