I've found in Cocoon docs:

"To set a default selection, just set the value of the widget containing the
selection list."

How to set this value?


Magsend wrote:
> 
> I have a repeater:
> 
>  
> 
> <fd:repeater id="test" orderable="false" initial-size="1">
> 
>                                                <fd:widgets>
> 
>                                                                <fd:field
> id="type">
> 
>  
> <fd:label>Types</fd:label>
> 
>  
> <fd:datatype base="string"/>
> 
>  
> <fd:selection-list src="cocoon:/selection-list-molecules"/>
> 
>                                                                </fd:field>
> 
>                                                               <fd:field
> id="amount">
> 
>  
> <fd:label>Amount</fd:label>
> 
>  
> <fd:datatype base="decimal"/>
> 
>                                                                </fd:field>
> 
>  
> <fd:booleanfield id="select">
> 
>  
> <fd:label>Select</fd:label>
> 
>  
> </fd:booleanfield>
> 
>                                                </fd:widgets>
> 
>                                </fd:repeater>
> 
>  
> 
> In the flowscript I transmit params from database to the form's repeater
> 
>  
> 
> var repeater = form.getChild("test"); 
> 
>                 for (var i = 0; i < comp_in_composition.size(); i++) {
> 
>                                var row = repeater.addRow(i); 
> 
>  
> row.getChild("type").setValue(comp_in_composition.get(i).get("type"));
> 
>  
> row.getChild("amount").setValue(comp_in_composition.get(i).get("amount"));
> 
>                                row.getChild("select").setValue(false);
> 
>                 }
> 
>  
> 
> The selection list is in file: 
> 
>  
> 
> <?xml version="1.0"?>
> 
>  
> 
> <fd:selection-list
> xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
> 
>                    xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
> 
>   <jx:forEach var="item" items="${items}">
> 
>     <fd:item value="${item.value}">
> 
>       <jx:if test="${item.label}">
> 
>         <fd:label>${item.label}</fd:label>
> 
>       </jx:if>
> 
>     </fd:item>
> 
>   </jx:forEach>
> 
> </fd:selection-list>
> 
>  
> 
> So, I need to have the elements "type" (selection-list) of the repeater 
> to
> be selected as in the database.
> 
> How can I do it?
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-pass-params-to-the-repeater%27s-selection-list-tp18792206p18793953.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to