Commit c39ff353 by cahrens

Don't assume input fields will be within a div.

https://edx.lighthouseapp.com/projects/102637/tickets/232
parent ecf395d6
......@@ -25,11 +25,14 @@ CMS.Views.ValidatingView = Backbone.View.extend({
for (var field in error) {
var ele = this.$el.find('#' + this.fieldToSelectorMap[field]);
this._cacheValidationErrors.push(ele);
if ($(ele).is('div')) {
var inputElements = 'input, textarea';
if ($(ele).is(inputElements)) {
$(ele).addClass('error');
}
else {
// put error on the contained inputs
$(ele).find('input, textarea').addClass('error');
$(ele).find(inputElements).addClass('error');
}
else $(ele).addClass('error');
$(ele).parent().append(this.errorTemplate({message : error[field]}));
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment