joerg 2004/07/03 09:06:51
Modified: src/blocks/forms/samples/forms form2_bind_xml.xml
Log:
setting the @id on-bind after inserts
Revision Changes Path
1.4 +14 -4
cocoon-2.1/src/blocks/forms/samples/forms/form2_bind_xml.xml
Index: form2_bind_xml.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/samples/forms/form2_bind_xml.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- form2_bind_xml.xml 13 Mar 2004 11:22:00 -0000 1.3
+++ form2_bind_xml.xml 3 Jul 2004 16:06:51 -0000 1.4
@@ -82,14 +82,24 @@
row-path="contact">
<fb:identity>
- <fb:value id="id" path="@id">
+ <fb:value id="id" path="@id" direction="load">
<!-- optional convertor to use for mapping the unique id -->
<fd:convertor datatype="long" />
</fb:value>
</fb:identity>
<fb:on-bind>
- <!-- executed on updates AND right after the insert -->
+ <!-- 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>
<fb:value id="firstname" path="firstname" />
<fb:value id="lastname" path="lastname" />
<fb:value id="phone" path="phone/@nr" />
@@ -97,8 +107,8 @@
</fb:on-bind>
<fb:on-delete-row>
- <!-- chose on of these to test -->
- <!--
+ <!-- chose on of these to test -->
+ <!--
<fb:set-attribute name="row-state" value="deleted" />
-->
<fb:delete-node />