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]