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 20:33:26 GMT
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


Mime
View raw message