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
This commit is contained in:
Ariel Backenroth
2006-10-05 06:52:27 +00:00
parent e8643d2003
commit fba8822043

View File

@@ -48,11 +48,13 @@ dojo.declare("alfresco.xforms.Widget",
{ {
this.modified = b; this.modified = b;
this._updateDisplay(); this._updateDisplay();
this.hideAlert();
}, },
setValid: function(b) setValid: function(b)
{ {
this.valid = b; this.valid = b;
this._updateDisplay(); this._updateDisplay();
this.hideAlert();
}, },
setRequired: function(b) setRequired: function(b)
{ {
@@ -144,6 +146,24 @@ dojo.declare("alfresco.xforms.Widget",
var node = this._getAlertNode(); var node = this._getAlertNode();
return node ? dojo.dom.textContent(node) : ""; 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() _updateDisplay: function()
{ {
// this.domContainer.style.backgroundColor = // this.domContainer.style.backgroundColor =
@@ -1220,12 +1240,13 @@ dojo.declare("alfresco.xforms.XForm",
case "xforms-submit-error": case "xforms-submit-error":
var invalid = this.rootWidget.getWidgetsInvalidForSubmit(); var invalid = this.rootWidget.getWidgetsInvalidForSubmit();
var msg = "Please provide values for all required fields."; var msg = "Please provide values for all required fields.";
msg += "<br/><ul>"; // msg += "<br/><ul>";
for (var j = 0; j < invalid.length; j++) for (var j = 0; j < invalid.length; j++)
{ {
msg += "<li>" + invalid[j].getAlert() + "</li>"; invalid[j].showAlert();
// msg += "<li>" + invalid[j].getAlert() + "</li>";
} }
msg += "</ul>"; // msg += "</ul>";
_show_error(msg); _show_error(msg);
break; break;
default: default: