cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: [Woody-binding] wb:repeater unique-path
Date Thu, 06 Nov 2003 10:54:39 GMT
On Thu, 2003-11-06 at 11:33, Antonio Gallardo wrote:
> Bruno Dumon dijo:
> > On Wed, 2003-11-05 at 20:30, Bruno Dumon wrote:
> >> On Wed, 2003-11-05 at 19:57, Bruno Dumon wrote:
> >> > On Wed, 2003-11-05 at 18:51, Antonio Gallardo wrote:
> >> > > Hi:
> >> > >
> >> > > I am trying to do a "form.save(bean)" from an empty displayed
> >> form.I have 2 days with this sample and still not working. :-(
> >> > >
> >> > >
> >> > > My problem is that inside the "repeater" there is only 1 value
> >> (res_id) of datatype integer.
> >> > >
> >> > > Binding just save the first 2 values and an empty repeater.
> >> >
> >> > Is the res_id field a field that the user can edit? The current
> >> repeater-binding assumes that new rows are those with an empty id
> >> field (res_id your case). Thus if these are editable by the user and
> >> the user puts a value in them, the repeater binding will not detect
> >> that these are new rows.
> >> >
> >> > However, it is of course possible to implement alternative
> >> > repeater-binding strategies. One that's also available is
> >> > wb:simple-repeater (see javadoc of the class
> >> > SimpleRepeaterJXPathBindingBuilder). This binding works by first
> >> removing all items, and the adding all the items in the repeater.
> >>
> >> After having a look at the source code, I'm afraid that binding
> >> currently only works for XML documents.
> >
> > Sylvain, would you mind if I changed the simple-repeater binding so that
> > its configuration lines up more with that of the other repeater binding?
> > I'm thinking of something like this:
> >
> > <wb:simple-repeater>
> >   <wb:on-bind>
> >     ...
> >   </wb:on-bind>
> >   <wb:on-insert-row>
> >     ...
> >   </wb:on-insert-row>
> > </wb:simple-repeater>
> >
> > The wb:on-insert-row element would be optional, if not specified the
> > binding would work as it is now (ie rely on JXPath to create the path).
> 
> I thought adding a new repeater will add more complexity to Cocoon forms.
> Better will be to add an attribute in <wb:repeater> that will allow the
> behavior or not. I propose something like:
> 
> unique-change="true" [default false]
> 
> If set to true, then the unique field can be changed.
> 
> Is this correct?

I think you're mixing stuff. The simple-repeater uses another strategy
to perform the binding, and doesn't need a unique identification (since
it simply deletes and re-adds everything).

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message