Sylvain Wallez wrote:
>
> This calls for binding-specific validators that know both the
> application model and the form model. I proposed to add XPath predicates
> to the binding for this purpose. E.g :
>
> <wb:field id="foo-field" path="foo">
>   <wb:validate>
>     <wb:assert test="java:validateFoo($currentBean, $currentField/value)">
>     <wi:fail-message>Business model rejects value for
> "foo"</wi:fail-message>
>   </wb:validate>
> </wb:field>
>
> The variables are predefined by the binding framework (this is at the
> random thought state) :
> - $currentBean is the bean holding the current property ("foo").
> - $currentField is the "foo-field" that is currently being bound.
>
> The "test" expression would thus call the "validateFoo" method on the
> business object.
>
Ok, this is a possibility, but I don't like it :)
I don't want to "code" this in the xml; it could be done automatically
by some rules, like a validateXXX() method in the business model.

I agree, that your suggestion makes sense in some cases, so I would still
go for both :)

Carsten

Reply via email to