Closed jarro closed 7 years ago
Hi jarro! Would you be able to provide an example reproduction? Thanks.
private val validator by lazy {
passport {
rules<String?>(view?.ti_username!!) {
email()
length(8, 32)
}
rules<String?>(view?.ti_middle!!) {
numeric()
}
}
}
private fun validate(): Boolean{
return validator.validate(view!!, ValidationMethod.IMMEDIATE)
}
With something like that, the numeric rule is applied to ti_username. Thought it was related to ValidationMethod.BATCH but happens with immediate as well. Seems like every rule is applied to every field.
Thanks, I'll take a look.
jarro, I've addressed this in the 2.0.1 release just now. What happened was that validators were being treated as singleton instances and being shared across views. I've changed this so that validators are now instanced from factory functions via Passport.validatorFactory().
I've updated the example activity to show this.
Thanks for the report!
Working great, thanks for the speedy fix.
I used the sample code and applied it to two fields. When I validate in batch mode, I end up with all three error messages on both fields.
Thanks for making this available, it is just what I was looking for.