I encountered a problem today: I have a form where a field is required or not depending on the value of another field. I wanted to control this using the validation (with a <wd:assert>) but couldn't as the validators aren't called if the value is null.
To allow this, I wanted to propose that, when a field isn't explicitely marked as required, validators be called even if the value is null.
But then comes another problem, since most validators expect a non-null value and will break on NPE if no value is given.
So what about the following changes:
- when a field isn't marked as required, validators are called even if the value is null,
- validators that need a value to do their job (e.g. regexp, range, email, etc) will return "true" (valid) for a null value
- other validators (such as assert) will behave according to their semantics with null values.
What do you think?
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com
