Marc Portier wrote:

Sylvain Wallez wrote:


<snip/>

Validators currently exist only for datatypes, and not yet for bindings (this is on my todo list).


yep, some nuance though:

there should be only one validation cycle!
what I mean is:

- we probably do want to be able to express validation-rules by using some of the syntax we currently find in the binding file, that is based on the business-object models we want to manipulate

- however: I don't see a reason for specific validation that only kicks in when doing the save-binding (i.e. typically at the end of the use case) since that would defy the whole idea of having a woody-form-model that can validate *early* some user-input?


When the form is bound to application data, datatype validation isn't enough and there *must* be some application data-related validation before saving.

Let's take the simple use case of user registration :
- datatype-level validation : name is not longer than 20 characters (--> "please use a shorter name")
- application data-level validation : name doesn't already exist in the database (--> "this name is already used. Please choose another one").


Note that the second validation, although binding-specific, can be performed early and doesn't need to be delayed until the save-binding.

having said that I still think the validators are tied to datatypes, only some of those datatypes are to be retrieved or introspected from the business domain directly (and can be expressed as such, including business specific validation)


I the above example, the second validation cannot be defined on the datatype, since it must be checked only when a *new* user is created and not everywhere a user name is input. It's therefore specific to the registration form.

or am I missing something?
(maybe all of this is introduced by 'binding' being a bad name for what it currently is: it really just is run-time data-mapping, not design-time typing)


Uh ? What do you mean by "design-time" and "run-time" ?

Sylvain

--
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




Reply via email to