Sylvain Wallez wrote:
Hi all,

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,

If a value is not required isn't it always valid on null-values?


- validators that need a value to do their job (e.g. regexp, range, email, etc) will return "true" (valid) for a null value

If the value is null and the field is not required it should be valid without even consulting the validator. Do I miss something?


- other validators (such as assert) will behave according to their semantics with null values.

-- Giacomo Pati Otego AG, Switzerland - http://www.otego.com Orixo, the XML business alliance - http://www.orixo.com

Reply via email to