cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Lutz <>
Subject Re: [CForms] Cardinality check for repeater
Date Wed, 28 Sep 2005 11:47:03 GMT
Sylvain Wallez wrote:

> <snip />
> Hmm... There are different issues here:
> Validation:
> We can extend the <fd:range> or <fd:value-count> validators so that 
> they can validate a repeater. But the issue then is that a repeater 
> has no way to automatically display its error, and therefore it's up 
> the template writer not to forget to add a <ft:validation-error> 
> somewhere.
> Enabling/disabling controls:
> This is different from validation, as the controls must be disabled to 
> ensure that we don't go outside of the specified constraints. This 
> cannot be implemented as a validator (which is called too late in the 
> process), and requires the concept of min and max rows to be built 
> into the repeater itself.
> I would go for this second solution, as it provides a better user 
> experience (you can't do the action, rather than having to correct it 
> afterwards), but this requires some changes to the repeater code:
> - add min-rows/max-rows properties

already done by jorg's patch

> - add support for repeater listeners, so that repeater-actions and 
> row-actions can register themselves on the repeater and automatically 
> change their state according to the size of the repeater.

Looking at the sources I found that there is a ActionListener class for 
each repeater-action, where rows are added and deleted. So would it be 
possible to ask the repeater for its min and max size at this places and 
disable the buttons ?
Then I could add some disable flag to the actions, which controls the 
rendering. So something that would automatically add a "styling 
disabled" fragment ?
Maybe it would be better to add the min and maxsize attributes to the 
repeater-action tags then.. as actually not the repeater, but the action 
would perform the validation ?

And maybe it could be possible to add "automatic validation message 
display" to the action, so that a alert would be displayed next to the 
disabled add button ?

Sorry, many questions :-),

View raw message