Dev at weitling wrote:
Hello folks,
I'm working for days on a binding problem. Narrowing the context of my
problem (nested repeaters) I'm still stuck with the configuration
described below (with 2.1.10, standard config). Everything loads fine
but when I hit the "Add row"-button a row is created without even
touching my beans/methods. I would at least expect an error when I omit
the target method or give an unavailable class.
Just to clarify, you're expecting your fb:on-insert-row to be executed
immediately after you press the Add Row button on your form? If so,
then I think there's a misunderstanding; the binding only executes at
the time of form.save(). At that point if there are more rows in the
repeater than items in the bean, then the fb:on-insert-row binding will
be executed to add enough items to the bean to hold the repeater's values.
Does this help or am I misreading your question?
Maybe I'm doing something fundamentally wrong but I can't see the
difference to examples known as working from the net.
:-?
Florian
#### flowscript ####
function test2 () {
var form = new Form("definitions/test2.xml");
form.createBinding("bindings/test2.xml");
var bean = new Packages.demo.Test2();
form.load(bean);
form.showForm("templates/test2.xml");
cocoon.sendPage("success");
}
#### definitions/test2.xml ####
<fd:repeater id="testRepeater">
<fd:widgets>
<fd:field id="testField">
<fd:datatype base="string"/>
</fd:field>
</fd:widgets>
</fd:repeater>
<fd:repeater-action id="addTestField" repeater="testRepeater"
command="add-row">
<fd:label>Add row</fd:label>
</fd:repeater-action>
#### bindings/test2.xml ####
<fb:repeater id="testRepeater" parent-path="." row-path="testFields">
<fb:on-bind>
<fb:value id="testField" path="testText"/>
</fb:on-bind>
<fb:on-insert-row>
<fb:insert-bean addmethod="addTestField"/>
</fb:on-insert-row>
</fb:repeater>
#### templates/test2.xml ####
<ft:repeater id="testRepeater">
<div>
<ft:repeater-rows>
<ft:widget id="testField"/>
</ft:repeater-rows>
</div>
</ft:repeater>
<ft:widget id="addTestField"/>
#### demo.Test2.java ####
Collection testFields = new ArrayList();
public Test2 () {
testFields.add(new TestField("argh"));
testFields.add(new TestField("urks"));
testFields.add(new TestField("blubb"));
}
public Collection getTestFields () {
return testFields;
}
#### demo.TestField.java ####
String testText;
public TestField (String testText) {
this.testText = testText;
}
public String getTestText () {
return testText;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]