cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject [cforms] Optionally required fields
Date Wed, 07 Jan 2004 16:58:26 GMT
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,
- 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 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

View raw message