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:[EMAIL PROTECTED] > Sent: 17 February 2005 20:38 > To: [email protected] > 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:[EMAIL PROTECTED] > >> Sent: 17 February 2005 18:56 > >> To: [email protected] > >> 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: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > --------------------------------------------------------------------- > > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
