This project has moved. For the latest updates, please go here.


LengthValidator validates null inputs


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 8:52 AM by JeremyS


JeremyS wrote Mar 26, 2013 at 11:04 AM

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


swingdoctor wrote Apr 7, 2013 at 7: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?


JeremyS wrote Apr 16, 2013 at 8:52 AM

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