You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Craig Gulliver <cg...@invoqsystems.com> on 2005/10/25 19:53:51 UTC

Simple Question on Repeaters

Hi All,

 

I would just like clarify the usage of repeaters.

 

I want to use the initial-size attribute of the repeater definition.
However I want to supply the value as form data and accessed as an
expression.  So my question, is it possible to use JXPath or JEXL
expressions in the form definition? For example, <fd:repeater
id="objectListing" initial-size="#{numberOfObjects}">.

 

 

Thanks,

 

Craig


Re: Simple Question on Repeaters

Posted by Sylvain Wallez <sy...@apache.org>.
Philippe Gassmann wrote:
> Craig Gulliver wrote:
>>
>> I want to use the initial-size attribute of the repeater definition. 
>> However I want to supply the value as form data and accessed as an 
>> expression. So my question, is it possible to use JXPath or JEXL 
>> expressions in the form definition? For example, <fd:repeater 
>> id=”objectListing” initial-size=”#{numberOfObjects}”>.
>>
>>
> Yes, you can use it if your form definition is procuced by a pipeline 
> like this
> <map:match pattern="myDynamicFormDefinition">
> <map:generate type="jx" name="path to the form definition.xml"/>
> </map:serialize type="xml"/>
> </map:match>
>
> After that you have to create your form using form = new 
> Form("cocoon:/myDynamicFormDefinition");
> But I do not know how to give parameters to the form definition that 
> are not "map:parameter"s

Oh man, a dynamic form definition to set the initial size is definitely 
overkill :-)

What about:
<fd:repeater id="objectListing">
<fd:on-create>
<fd:javascript>
var initialSize = ... whatever expression you want here ...
// Create new rows until we reach the wanted size
while(widget.size < initialSize) widget.addRow();
</fd:javascript>
</fd:on-create>
...

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


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


Re: Simple Question on Repeaters

Posted by Philippe Gassmann <ph...@anyware-tech.com>.
Craig Gulliver wrote:

>  
>
> I want to use the initial-size attribute of the repeater definition.  
> However I want to supply the value as form data and accessed as an 
> expression.  So my question, is it possible to use JXPath or JEXL 
> expressions in the form definition? For example, <fd:repeater 
> id="objectListing" initial-size="#{numberOfObjects}">.
>
>
Yes, you can use it if your form definition is procuced by a pipeline 
like this
<map:match pattern="myDynamicFormDefinition">
    <map:generate type="jx" name="path to the form definition.xml"/>
    </map:serialize type="xml"/>
</map:match>

After that you have to create your form using form = new 
Form("cocoon:/myDynamicFormDefinition");
But I do not know how to give parameters to the form definition that are 
not "map:parameter"s


-- 
Philippe GASSMANN
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/