cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Pope" <ben_p...@REMOVE_MEhotmail.com>
Subject RE: [CForms] Creating unique ids for new repeater rows
Date Thu, 17 Feb 2005 23:18:27 GMT
I guess I should also mention that it's probably prudent to set the @id
direction to load only:

  <fb:repeater id="contacts"
               parent-path="contacts"
               row-path="contact">

    <fb:identity>
      <fb:value id="id" path="@id" direction="load">
..


Otherwise the element is bound in the save direction twice, I don't know
what the implications are.

Ben
 

> -----Original Message-----
> From: Ben Pope [mailto:ben_pope@REMOVE_MEhotmail.com] 
> Sent: 17 February 2005 23:10
> To: users@cocoon.apache.org
> Subject: RE: [CForms] Creating unique ids for new repeater rows
> 
> Err... Yeah.
> 
> I'm using the 2.2 trunk.
> 
> I had noticed that this was "new" but I didn't know how new.  
> Should have checked, but since I decided to use 2.2-dev, I 
> pretty much got rid of 2.1.6.
> 
> Should have some form of 2.1.x installed really :-p
> 
> As long as you "get the idea" from that snippet, I guess all is well.
> 
> Ben
> 
> 
> 
> 
> > -----Original Message-----
> > From: Alex Romayev [mailto:romayev@yahoo.com]
> > Sent: 17 February 2005 20:38
> > To: users@cocoon.apache.org
> > Subject: Re: [CForms] Creating unique ids for new repeater rows
> > 
> > Thanks Ben, this is exactly what I was looking for.  Actually I 
> > form2_bind_xml.xml is the file I've been looking at and 
> it's not in my 
> > version of it (2.1.6 release), are you using the HEAD version?
> > 
> > Thanks again,
> > -Alex
> > 
> > 
> > On Feb 17, 2005, at 3:33 PM, Ben Pope wrote:
> > 
> > > If you check out the form examples, you'll see:
> > >
> > >     <fb:on-bind>
> > >       <!-- executed on updates AND right after the insert -->
> > >       <fb:javascript id="id" path="@id" direction="save">
> > >         <fb:save-form>
> > >           var appValue = jxpathPointer.getValue();
> > >           if (appValue == '') {
> > >               var precSiblId =
> > > jxpathContext.getValue("../preceding-sibling::contact/@id");
> > >               var newId = Number(precSiblId) + 1
> > >               jxpathPointer.setValue(newId.toFixed(0));
> > >           }
> > >         </fb:save-form>
> > >       </fb:javascript>
> > >
> > > Which is inside:
> > > form2_bind_xml.xml
> > >
> > > Which is (probably) run from:
> > > http://localhost:82/samples/blocks/forms/form2xml.flow
> > >
> > > (I'm sure you'll figure out the URL differences)
> > >
> > > Which seems to work ok for me.
> > >
> > > Ben
> > >
> > >
> > >
> > >
> > >> -----Original Message-----
> > >> From: Alex Romayev [mailto:romayev@yahoo.com]
> > >> Sent: 17 February 2005 18:56
> > >> To: users@cocoon.apache.org
> > >> Subject: [CForms] Creating unique ids for new repeater rows
> > >>
> > >> I'm a bit stuck here in trying to figure out how to assign
> > a unique
> > >> id to new repeater rows.  I tried referencing an 
> external pipeline:
> > >>
> > >>      <fb:on-insert-row>
> > >>        <fb:insert-node src="cocoon:/default-record"/>
> > >>      </fb:on-insert-row>
> > >>
> > >> where the "default-record" pipeline would create a record
> > and assign
> > >> a unique id attribute, however, it seems that the pipeline
> > is being
> > >> called only once, so all my records end up getting the same id.
> > >>
> > >> It feels like there should be an obvious simple way of
> > doing it and
> > >> I'm just completely missing it!
> > >>
> > >>
> > >> Thanks,
> > >> -Alex
> > >>
> > >>
> > >> 
> > 
> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > >> For additional commands, e-mail: users-help@cocoon.apache.org
> > >>
> > >>
> > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

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


Mime
View raw message