2

Closed

LengthValidator validates null inputs

description

Most validators should not validate null input, because that condition is validated with NotNull. LengthValidator assumes a length of 0 for null, breaking the convention.

I think LengthValidator should return true for null inputs.
Closed Apr 16, 2013 at 9:52 AM by JeremyS

comments

JeremyS wrote Mar 26, 2013 at 12:04 PM

Thanks for the suggestion. I need to have a think about the implications for changing this, as it would be a breaking change.

Jeremy

swingdoctor wrote Apr 7, 2013 at 8:25 PM

I also think this would be a great change to make as it would then mimic current mvc length validator functionality (and get around a problem I'm currently having).

Incidentally, in web forms validation, there used to be a bool property on the validators that would allow you to validate (or not) empty strings (ValidateEmptyText I think??). Maybe an addition of such a property in this instance could avoid it being a breaking change?

Joel

JeremyS wrote Apr 16, 2013 at 9:52 AM

I've made this change in the latest commit. Let me know how it works for you.