Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equalTo failed #211

Closed
kiro112 opened this issue Feb 27, 2014 · 2 comments
Closed

equalTo failed #211

kiro112 opened this issue Feb 27, 2014 · 2 comments

Comments

@kiro112
Copy link

kiro112 commented Feb 27, 2014

validation: function() {
return {
username: {
required: true,
msg: ''
},
password: {
minLength: 8
},
rePassword: {
equalTo: 'password',
msg: 'The passwords does not match'
},
name: {
required: true,
msg: '
'
},
address: {
required: false,
msg: ''
},
email: {
required: true,
msg: '
'
}
};
}

the rePassword and password is always not match even if it is match
im using Backbone.Validation v0.9.1
with model.preValidate()

@ragulka
Copy link

ragulka commented Feb 27, 2014

Just stumbled upon this very same issue. And I figured out what's causing this. When You are using preValidate, equalTo still looks for the value from model, not from the attributes hash you passed in. Because you haven't set the value on model yet, validation fails. I think this is a bug and needs to be addressed.

@chiefGui
Copy link
Collaborator

@ragulka is right, the problem only happens on preValidate.

Let's continue talking on #212.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants