cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: disabling widgets
Date Fri, 27 Feb 2004 22:24:12 GMT
Jeremy Quinn wrote:

>
> On 25 Feb 2004, at 12:32, Reinhard Poetz wrote:
>
>>
>>
>>> -----Original Message-----
>>> From: Antonio Gallardo [mailto:agallardo@agssa.net]
>>> Sent: Wednesday, February 25, 2004 1:28 PM
>>> To: dev@cocoon.apache.org
>>> Subject: Re: disabling widgets
>>>
>>>
>>> Jeremy Quinn dijo:
>>>
>>>> Hi All
>>>>
>>>> I have a booleanfield widget, that needs to be disabled
>>>
>>> under certain
>>>
>>>> conditions.
>>>>
>>>> pseudo-code :
>>>>
>>>>     if ( album.scenarios.size() > 0 ) {
>>>>          disable ( album.publishable );
>>>>     }
>>>>
>>>> ie. the album.publishable value needs to be in the form, but should
>>>> not be alterable by the user.
>>>>
>>>> Is there a way of doing this in Cocoon Forms ?
>>>
>>>
>>> Another approach (not tested by me, but maybe works) is using
>>> the JXTemplateGenerator. There is a <jx:if> tag that can be
>>> use to show/hide controls in the rendered page.
>>
>>
>> IIRC Sylvain extendet the showform function so that you can pass the
>> objects to the view layer. You could either use Antonio's suggestion or
>> you add a parameter to the widget styling.
>

Yep. Form.showForm has the same parameters as cocoon.sendPageAndWait(), 
as there's no reason not to be able to pass some additional application 
data to the view when using forms.

> So what you are saying is this? :
>
>     1. add appropriate JX-Template conditional statement to my 
> booleanfield widget
>         which will add @readonly="readonly" to the wi:styling if the 
> condition is met
>     2. pass the required BizData to the showform method as required by 
> the conditional above
>     3. use JX-Generator instead of the FileGenerator in my Woody 
> pipeline to pre-process
>         my Woody-Template before it goes to the Woody Transformer


Or also, use the woody template implementation using JX macros sent by 
Christopher a while ago. I started using this approach this week, which 
I needed that for two purposes:
- display a "no items" text when a repeater is empty instead of an empty 
table with only headers,
- implement a very specific styling for an output widget: it contains 
the ID of a node in a tree, and I needed to display the path of this node.

Conclusion: *it rocks*! Being able to access the form model within the 
generator allows to very easily build sophisticated presentations for a 
form.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message