diff options
Diffstat (limited to 'StoneIsland/www/js/lib/view/Serializable.js')
| -rwxr-xr-x | StoneIsland/www/js/lib/view/Serializable.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/StoneIsland/www/js/lib/view/Serializable.js b/StoneIsland/www/js/lib/view/Serializable.js index f1c61072..4155f102 100755 --- a/StoneIsland/www/js/lib/view/Serializable.js +++ b/StoneIsland/www/js/lib/view/Serializable.js @@ -70,8 +70,9 @@ var SerializableView = View.extend({ update_select: function(e){ var $target = $(e.currentTarget), value = $target.val() var label = $target.find("option").filter(function(){ return this.value === value }).html() - $target.parent().addClass("picked") - $target.parent().find("span").html(label) + var $parent = $target.parent() + $parent.addClass("picked").removeClass("error_hilite") + $parent.find("span").html(label) }, update_date: function(e){ @@ -103,10 +104,17 @@ var SerializableView = View.extend({ console.log("showing errors") console.log(errors) var msgs = [] + this.$('.error_hilite').removeClass('error_hilite') errors.forEach(function(e, i){ - if (i > 0) { return } + // if (i > 0) { return } if (e[0]) { - this.$("[name=" + e[0] + "]").addClass('error_hilite') + var $el = this.$("[name=" + e[0] + "]") + var el = $el[0] + if (el && el.nodeName === 'SELECT') { + $el.parent().addClass('error_hilite') + } else { + $el.addClass('error_hilite') + } } msgs.push(e[1]) }.bind(this)) |
