Update of /var/cvs/applications/taglib/blocks/test
In directory james.mmbase.org:/tmp/cvs-serv19946
Modified Files:
form.jspx
Log Message:
See also: http://cvs.mmbase.org/viewcvs/applications/taglib/blocks/test
Index: form.jspx
===================================================================
RCS file: /var/cvs/applications/taglib/blocks/test/form.jspx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- form.jspx 19 Nov 2008 16:34:28 -0000 1.9
+++ form.jspx 19 Nov 2008 17:00:17 -0000 1.10
@@ -9,16 +9,23 @@
<h2>mm:form</h2>
<h3>Create in a form 2 new nodes and a relation between them</h3>
- <mm:form id="form1" mode="validate">
+ <mm:form id="form1" mode="transaction">
<c:catch var="e">
- <mm:createnode type="news" id="news" />
- <mm:createnode type="urls" id="url" />
+ <mm:createnode type="news" id="news">
+ <mm:setfield name="title">Test news article</mm:setfield>
+ </mm:createnode>
+
+ <mm:createnode type="urls" id="url">
+ <mm:setfield name="name">bla bla bal</mm:setfield>
+ <mm:setfield name="url">http://<mm:time time="now" /></mm:setfield>
+ </mm:createnode>
<mm:createrelation source="news" destination="url" role="posrel" id="r"
/>
<mm:node referid="r">
<p>Will create relation: ${_node}: <mm:nodeinfo type="gui" /></p>
</mm:node>
<mm:commit />
+ <p>Committed</p>
<mm:node referid="r">
<p>Created relation: ${_node}: <mm:nodeinfo type="gui" /></p>
</mm:node>
@@ -26,7 +33,7 @@
</c:catch>
</mm:form>
- <p>${e}</p>
+ <p>1: ${e}</p>
<h3>Create in a form 1 new node and a relation between that and an existing
node</h3>
<mm:form id="form2">
@@ -48,13 +55,14 @@
</mm:node>
</mm:present>
</c:catch>
+ <p>${e}</p>
</mm:form>
- ${e}
<h3>Actually show a form</h3>
- <c:catch var="e">
<mm:form id="form3">
+ <c:catch var="e">
+
<mm:createnode type="news" id="news3" commitonclose="false"> <!-- TODO,
perhaos it's better if commitonclose is false on default if node in transaction
-->
<mm:field name="title">
<mm:fieldinfo type="input" />
@@ -77,14 +85,14 @@
<p>NOT VALID</p>
</mm:valid>
</mm:present>
- </mm:form>
</c:catch>
<p>${e}</p>
+ </mm:form>
<h3>A form which can handle both new and existings nodes</h3>
<mm:import externid="article">new</mm:import>
<mm:form id="form4">
- <c:catch>
+ <c:catch var="e">
<c:choose>
<c:when test="${article eq 'new'}">
@@ -106,7 +114,7 @@
<mm:import externid="submit4" />
<mm:present referid="submit4">
<mm:valid>
- <mm:node number="${url}" id="url4" />
+ <mm:node number="${url}" id="url4" commitonclose="false" />
<mm:createrelation source="article" destination="url4" role="posrel"
id="r4" />
<mm:commit />
<p>Commited.</p>
@@ -119,22 +127,23 @@
</mm:valid>
</mm:present>
</c:catch>
-
+ <p>${e}</p>
</mm:form>
<h3>Split up in 2 mm:forms</h3>
<mm:form name="form5" mode="transaction"> <!-- if mode trnasaction a html
form is avoided -->
- <c:catch>
- <mm:createnode type="news" id="news5">
+ <c:catch var="e">
+ <mm:createnode type="news" id="news5" commitonclose="false">
<mm:field name="title">
<mm:fieldinfo type="input" />
<mm:fieldinfo type="errors" />
</mm:field>
</mm:createnode>
</c:catch>
+ <p>${e}</p>
</mm:form>
<mm:form id="form5" name="form5">
- <c:catch>
+ <c:catch var="e">
<input type="submit" name="submit5" />
<mm:import externid="submit5" />
<mm:present referid="submit5">
@@ -149,6 +158,7 @@
</mm:valid>
</mm:present>
</c:catch>
+ <p>${e}</p>
</mm:form>
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs