[FIXED][2.x] TextField bypasses other validation if allowBlank set

By default, the validateValue method in TextField checks for a zero-length (or == emptyText) value first, and if allowBlank is true, it returns with no more ado.

This allows blank fields to bypass any other configured validation.

You may say that the allowBlank setting means all bets are off, and the field is definitely valid. I don't believe this is the case. It means that blank is allowed, but configured validators; either the validator config, or vtype should also get their say.

Also certain other postprocessing functionality in addition to pure validation often needs to be hung off a validator function.

I suggest the following override which moves configured validation to the top of the method:

Perhaps some rules, depending upon how the validation works would occasionally disallow blank even though it is allowed.

More importantly, a [B]validator[B] may then be used for simply processing the field's value during typing if the BasicForm's monitorValid is true.

But either way, that test at the top is too overriding. If null is allowed and it's null, then that overrides everything else - it's definitely valid. I's say it's just not invalid, conditional on other validation also passing.

There's a 3 way choice here which is not covered.

A validation can pass, and return immediately, ignoring other types of validation following on which might invalidate the value. This is what happens now.

A validation can pass, and drop through to the next validation type to continue validation.

A validation can fail. In which case, return early because it is invalid.

I vote for Animals solution. For example I have a form in which a field can be blank or not debending on other fields. My validator checks the dependencies. But without Animals overwrite the function never reaches my validator.