diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-08-31 14:53:08 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-08-31 14:53:08 +0200 |
| commit | 28b7ef196eaca6b9e455846cf6233bbabd9e4513 (patch) | |
| tree | eaf3fa41bed3a4988997587c865e2a6e1ceb45dd /StoneIsland/platforms/android/assets/www/js/lib/view/Serializable.js | |
| parent | 189eccc46edd09e78c9683580ccf078c28d5b34e (diff) | |
deploy android
Diffstat (limited to 'StoneIsland/platforms/android/assets/www/js/lib/view/Serializable.js')
| -rwxr-xr-x | StoneIsland/platforms/android/assets/www/js/lib/view/Serializable.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/StoneIsland/platforms/android/assets/www/js/lib/view/Serializable.js b/StoneIsland/platforms/android/assets/www/js/lib/view/Serializable.js index de5fe951..4155f102 100755 --- a/StoneIsland/platforms/android/assets/www/js/lib/view/Serializable.js +++ b/StoneIsland/platforms/android/assets/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,9 +104,18 @@ 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 } - this.$("[name=" + e[0] + "]").addClass('error_hilite') + // if (i > 0) { return } + if (e[0]) { + 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)) this.$msg.html(msgs.join("<br>")) |
