On 09.07.2004 09:19, Nicole Hochleiter wrote:
In stepping through org.apache.cocoon.forms.binding.RepeaterJXPathBinding
public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException I got the impression, that my new added element
overwrites an existing one.
I'm working with bean binding, cocoon.2.1.5, Java 1.4.2. Is it a
bug or did I miss something in the configuration? I got the idea
that this is a bug, because I could fix this 'bug' in my special
case in putting some lines into that class, like: (but I do not
want to keep it)
...
Is it really a bug or can I fix my problem in configuring something?
I had no look into your patch, but for me repeater binding works without any patch, so it's probably a misconfiguration in your binding file.
In my binding file I configured the repeater as follows: <fb:repeater id="structureUser" parent-path="." row-path="user">
<fb:identity> <fb:value id="id" path="id"/> </fb:identity>
<fb:on-bind> <!-- executed on updates AND right after the insert --> <fb:value id="id" path="id"/>
This one duplicates the binding of fb:identity.
... </fb:on-bind>
<fb:on-delete-row> <fb:set-attribute name="isDeleted" value="true" /> </fb:on-delete-row>
<fb:on-insert-row> <fb:insert-bean classname="com.seitenbau.objectmodel.User" addmethod="addUser"/>
This method handles the adding of new beans, so maybe you do something wrong there? My addObject methods mostly only look like:
public void addObject(Object obj) { this.objects.add(obj); }
where this.objects is a collection. I guess it's the same for you.
</fb:on-insert-row>
</fb:repeater>
the model has something like: <fd:repeater id="strukturUser" initial-size="0"> <fd:label>User</fd:label> <fd:widgets> <fd:field id="id"> <fd:datatype base="string"/> </fd:field>
Do you have the id fields in the client, maybe as hidden input? If not they will loose their values.
[...]
<fd:booleanfield id="select">
<fd:label>choose</fd:label>
</fd:booleanfield>
</fd:widgets>
</fd:repeater>
<fd:repeater-action id="adduser" action-command="add-row"
repeater="strukturUser">
<fd:label>add user</fd:label>
</fd:repeater-action>
<fd:repeater-action id="removeuser" action-command="delete-rows"
repeater="strukturUser" select="select">
<fd:label>remove user</fd:label>
</fd:repeater-action>
and my com.seitenbau.objectmodel.User bean has a getter and setter for id.
I don't have a setter at all as cforms does not generate my ids. So I also only have a direction="load" binding for the ids. Additionally I do not deliver the ids to the client and so only have an fd:output for all ids.
So there are three possible sources of trouble: 1. fd:field vs. fd:output 2. (duplicate) binding for id and implicit direction="both" 3. addUser method
Joerg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]