Alessandro, thanks a lot for advice, but in cocoon docs I've found a little
information about Binding Framework and how to use it with the database.
Could you please post me the sample code of database communications with
binding framework ?
Alessandro Vincelli wrote:
>
> You can use code similar to
> form.getChild("test").getChild("type").setValue("...") before the
> form.showForm(), but i think the best solution is the Binding
> Framework[1].
>
> Bye
> Alessandro
>
> [1] The best solution is the Binding Framework. You can bind the vale
> from the
>
>
> Magsend wrote:
>> 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?
>>>
>>>
>>>
>>>
>>
>>
>
>
> begin:vcard
> fn:Alessandro Vincelli
> n:;Alessandro Vincelli
> url:http://www.alessandro.vincelli.name
> version:2.1
> end:vcard
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
View this message in context:
http://www.nabble.com/how-to-pass-params-to-the-repeater%27s-selection-list-tp18792206p18800944.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]