Closed JeroenVinke closed 8 years ago
@JeroenVinke I found this to work (https://gist.run/?id=89fd2c2e4ddc195c19f5717920312a2f).
ValidationRules
.ensure('lastName')
.required()
.on(this.user);
Since ensure
requires a property of an object, make the validation rules check this.obj
(this.user
in your case). Not sure if this is the correct way - but might be a workaround.
@devanp92 Thanks, I'm aware of that, but this feature request is mainly for doing things like this:
ValidationRules
.ensure('password.original').required()
.ensure('lastName').required()
.on(this.user);
where one property exists directly on the object and one property exists in a subproperty. The binding engine is awesome at parsing expressions like password.original
so it should be able to do this automagically :smile:
@JeroenVinke Gotcha. That sounds like a useful feature to add! :+1:
Any idea when this might be available? I want to start using the spoonx orm but I can't until model.property works for the ValidationRules
main repo has same issue
I pull in some entities through breeze that have navigation properties, and I need to validate properties on the navigation property. So it would help me big time if this could be supported:
https://gist.run/?id=8ead16d0aa96a1c59b14eecbc59538fd