cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Larson <...@keow.org>
Subject Re: fd:repeater-action
Date Wed, 30 Jun 2004 04:23:44 GMT
On Wed, Jun 30, 2004 at 03:37:56AM +0200, Joerg Heinicke wrote:
> On 29.06.2004 18:52, Peter Velychko wrote:
> >Hello Johnson,
> >
> >Thank you for your reply.
> >Could you please describe your advice?
> 
> >And requirements are the following:
> >- default (and minimal) qty of rows in repeater is 1
> >- user is able to add new row to repeater
> >- user is able to remove any of repeater's row when qty of rows is
> >  more than 1
> >- user cannot remove repeater's row when qty == 1
> >
> >As I understand theoretically I can set up <fi:styling type='hidden'/>
> >for my repeater-action in JX template but I don't understand how.
> 
> Setting it in the template would be statically and not what you want I 
> guess. And even if it is hidden or not in the HTML code at all it would 
> be possible to hack the URL to remove the last item.
> 
> What you probably need is fd:union:
> http://wiki.cocoondev.org/Wiki.jsp?page=TimLarson
> Form model GUI sample.
> Though I can not imagine how to express the dependency on the repeater 
> size at the moment (it's just to late ;-). Maybe Tim can help here.

We _should_ add support for having the union be dependent on a
general expression instead of just a widget (patches welcome),
but for now you would setup event handlers to catch the row add
and delete events on the repeater widget, and use these handlers
to update a hidden output widget with the case values you want.
Then use this widget as the case-determining-widget for the union.

Rember you have other issues to deal with also, like deciding how
you want to handle a "delete 3 of 3 rows" request.  Do you delete
no rows then (and give the user some clue why you denied their
request?), or do you delete just 2 (which 2 do you choose?).

The "repeater action" widgets may not give you enough control,
since you cannot intercept them to change their behavior.
You might need to just use normal "action" widgets and make the
row add and delete calls manually against the repeater widget
via your custom action handlers.  You can use a "union" to hide
the action widget buttons when they really do not make sense
(like don't show the delete button when there is only 1 row),
but you might also need the extra control that normal "action"
widgets give so you can handle cases like the "delete 3 of 3
rows" example I gave above.

--Tim Larson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message