SWF-937 - Decorating by ValidateAllDecoration non existing element causes js error with no console help.

This commit is contained in:
Jeremy Grelle
2008-11-10 18:22:27 +00:00
parent 602ecb7b37
commit 23e1a97297
2 changed files with 17 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@@ -95,11 +95,15 @@ dojo.declare("Spring.ValidateAllDecoration", [Spring.AbstractValidateAllDecorati
apply : function() {
var element = dojo.byId(this.elementId);
this.originalHandler = element[this.event];
var context = this;
element[this.event] = function(event){
context.handleEvent(event, context);
};
if (!element) {
console.error("Could not apply ValidateAll decoration. Element with id '" + this.elementId + "' not found in the DOM.");
} else {
this.originalHandler = element[this.event];
var context = this;
element[this.event] = function(event){
context.handleEvent(event, context);
};
}
return this;
},
@@ -132,8 +136,13 @@ dojo.declare("Spring.AjaxEventDecoration", [Spring.AbstractAjaxEventDecoration,
},
apply : function() {
this.validationSubscription = dojo.subscribe(this.elementId+"/validation", this, "_handleValidation");
this.connection = dojo.connect(dojo.byId(this.elementId), this.event, this, "submit");
var element = dojo.byId(this.elementId);
if (!element) {
console.error("Could not apply AjaxEvent decoration. Element with id '" + this.elementId + "' not found in the DOM.");
} else {
this.validationSubscription = dojo.subscribe(this.elementId+"/validation", this, "_handleValidation");
this.connection = dojo.connect(element, this.event, this, "submit");
}
return this;
},