You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Jens v.P." <de...@jevopi.de> on 2003/07/24 16:09:21 UTC

validator - "split" resources and make it more dynamical

Hi,

I want to extend the validator framework but I'm not sure if my concept 
is working or not :)

The validator framework is great for static forms, such as html-forms 
and all that stuff used by struts. A common question in the struts user 
mailing list is how to make the validator a little bit more 
"dynamically". There are dynamic aspects:

1) Generate or define formsets on the fly
2) Modify formsets between two "page" impressions

As far as I've understood the design and code of the validator, it's 
possible to add FormSets on the fly - how these new FormSets are 
created is a problem left to me (e.g. copy and paste the 
FormSet-reading commands for the digester from the 
ValidatorResourcesInitializer class).

The problem is that I didn't found a way to remove a FormSet from the 
ValidatorResources. Is this possible? I guess the problem behind that 
is that FormSets are assumed to be user independent, that is a FormSet 
is created and user related data are validated, but the FormSet itsself 
is not modified - it's immutable. In some cases immutable FormSets have 
to be removed, e.g. if too many FormSets can be created. In other 
cases, even worst, FormSets can become user dependent, e.g. if a 
FormSets represents a protocol (such as: what have you eaten today - 
and the user can add an undefined amount of answers). In this case a 
FormSet and its definition must be separated from the definitions of 
the validator beans.

I like the validator framework for validating the forms, and adding 
JavaScript is a great functionality. Now I try to extend the framework, 
but I'm not sure if it's possible.

E.g. I'm thinking of separating the validation.xml related stuff from 
the validation-rules.xml stuff (not only separate files but also two or 
more ValidatorResources which are to be chained or something). 
Additionally I need some more configurations, such as filters (if a 
user has got no car, you don't have to ask what type of car he owns) 
and evaluation beans (reading the properties aka answers and evaluating 
another property, e.g. asking for width, height and depth of something 
and "evaluate" the volume).

Does somebody has any experiences on that topic?

Jens