cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Simple Question on Repeaters
Date Wed, 26 Oct 2005 09:45:40 GMT
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


Mime
View raw message