You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dev at weitling <de...@weitling.net> on 2007/03/01 10:36:12 UTC

on-insert-row & bean binding problem

Hi!

I have a form with two nested repeaters bound to three bean classes
(form -> Question, form/localeRepeater -> LocalizedQuestion,
form/localeRepeater/answerrepeater -> Answer). Loading works fine, but
adding a new answer row doesn't work as expected. In LocalizedQuestion
there is a method "addAnswer", creating a new answer and adding it to my
answers list. But this method is never called, although with a push on
the "Add answer"-button a new (empty) answer row is created.

# Extract from the definition file: #
<fd:repeater id="answerRepeater">
    <fd:widgets>
        <fd:output id="answerID">
            <fd:datatype base="integer"/>
        </fd:output>
        <fd:field id="data">
            <fd:datatype base="string"/>
        </fd:field>
    </fd:widgets>
</fd:repeater>

<fd:repeater-action id="addAnswer" command="add-row"
repeater="answerRepeater">
    <fd:label>Add answer</fd:label>
</fd:repeater-action>

# Extract from the template file: #
<ft:repeater id="answerRepeater">
    <ft:repeater-rows>
        <ft:widget id="answerID" class="answerID"/>: <ft:widget
id="data" dojoType="inlineEditBox" fi:type="inplace"/>
    </ft:repeater-rows>
</ft:repeater>

<ft:widget id="addAnswer"/>

# Extract from the binding file #
<fb:repeater id="answerRepeater" parent-path="." row-path="answers">
    <fb:identity>
        <fb:value id="answerID" path="id"/>
    </fb:identity>
   
    <fb:on-bind>
        <fb:value id="data" path="data"/>
    </fb:on-bind>
   
    <fb:on-insert-row>
        <fb:insert-bean addmethod="addAnswer"/>
    </fb:on-insert-row>
</fb:repeater>

Interesting is that there isn't any difference if I omit the addmethod
attribute, but when I omit the whole fb:insert-bean.

# The LocalizedQuestion in ultra-short: #
Collection answers;
public Collection getAnswers () {...}
public void addAnswer () {
    // do something wonderful
    // (if you can...)
}

Any help appreciated!
Florian

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