fix a bug in Ox.Form, regarding error messages on submit

This commit is contained in:
rlx 2011-10-22 15:22:39 +00:00
parent 6eef7c567b
commit 329b82845e

View file

@ -86,12 +86,11 @@ Ox.Form = function(options, self) {
function submitCallback(data) { function submitCallback(data) {
data.forEach(function(v, i) { data.forEach(function(v, i) {
self.$items[i].setMessage(v.message); self.$items[getItemIndexById(v.id)].setMessage(v.message);
}); });
} }
function validate(pos, valid) { function validate(pos, valid) {
//Ox.print('FORM validate', pos, valid)
self.itemIsValid[pos] = valid; self.itemIsValid[pos] = valid;
if (Ox.every(self.itemIsValid) != self.formIsValid) { if (Ox.every(self.itemIsValid) != self.formIsValid) {
self.formIsValid = !self.formIsValid; self.formIsValid = !self.formIsValid;