You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2005/09/03 11:29:25 UTC
svn commit: r267441 - in
/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms: form1_binding.xml
form1_model.xml form1_template.xml
Author: reinhard
Date: Sat Sep 3 02:29:21 2005
New Revision: 267441
URL: http://svn.apache.org/viewcvs?rev=267441&view=rev
Log:
more samples with FormsLibrary
Modified:
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml
cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml?rev=267441&r1=267440&r2=267441&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_binding.xml Sat Sep 3 02:29:21 2005
@@ -24,6 +24,6 @@
<fb:new id="lib:class1"/>
<fb:expand id="lib:ext:field2"/>
- <fb:value id="field3" path="field3" extends="lib:ext:field2"/>
+ <fb:value id="myField3" path="field3" extends="lib:ext:field2"/>
</fb:context>
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml?rev=267441&r1=267440&r2=267441&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_model.xml Sat Sep 3 02:29:21 2005
@@ -24,9 +24,116 @@
<fd:new id="lib:class1"/>
<fd:expand id="lib:ext:field2"/>
- <fd:field id="field3" extends="lib:ext:field2">
- <fd:datatype base="integer"/>
+ <fd:field id="myField3" extends="lib:ext:field2">
+ <fd:label>Field3:</fd:label>
+ <fd:datatype base="string"/>
+ <fd:help>
+ help test from the form model
+ <small>Anyway, the point of all this was to show a popup help with mixed html content.</small>
+ </fd:help>
</fd:field>
+
+ <fd:field id="myField4" extends="lib:ext:field2">
+ <fd:label>Field4:</fd:label>
+ <fd:on-value-changed>
+ <javascript>
+ var newValue = event.source.value;
+ java.lang.System.err.println("Was here! value=" + newValue);
+ var field5 = event.source.parent.lookupWidget("myField5");
+ field5.value = "model";
+ </javascript>
+ </fd:on-value-changed>
+ </fd:field>
+
+ <fd:field id="myField5" extends="lib:ext:field2">
+ <fd:label>Field5:</fd:label>
+ </fd:field>
+
+ <fd:field id="myEmail" extends="lib:ext:email" required="true">
+ <fd:validation>
+ <fd:length exact="10">
+ <fd:failmessage>Must be 10 characters long</fd:failmessage>
+ </fd:length>
+ </fd:validation>
+ <fd:label>Enter your customer's email adress: (inherited)</fd:label>
+ </fd:field>
+
+ <fd:field id="myAccount" extends="lib:ext:account"/>
+
+ <fd:field id="myAccount1" extends="lib:ext:account">
+ <fd:label>Indicate the size of your bank account (in m<sup>3</sup>): (inherited)</fd:label>
+ <fd:selection-list>
+ <fd:item value="6"/>
+ <fd:item value="7"/>
+ <fd:item value="8">
+ <fd:label>eight</fd:label>
+ </fd:item>
+ <fd:item value="9"/>
+ <fd:item value="10"/>
+ </fd:selection-list>
+ </fd:field>
+
+ <fd:multivaluefield id="myBeer" extends="lib:ext:drinks">
+ <fd:validation>
+ <fd:value-count exact="2"/>
+ </fd:validation>
+ <fd:selection-list>
+ <fd:item value="Amstel"/>
+ <fd:item value="Heinecken"/>
+ <fd:item value="Erdinger"/>
+ <fd:item value="Ottakringer"/>
+ </fd:selection-list>
+ </fd:multivaluefield>
+
+ <!--
+ <fd:repeater id="contacts">
+ <fd:validation>
+ <fd:javascript>
+ java.lang.System.err.println("Validating");
+ return true
+ </fd:javascript>
+ </fd:validation>
+ <fd:widgets>
+ <fd:field id="firstname">
+ <fd:label>Firstname</fd:label>
+ <fd:datatype base="string"/>
+ <fd:on-create>
+ <fd:javascript>
+ java.lang.System.err.println("Creating a new contact row");
+ </fd:javascript>
+ </fd:on-create>
+ </fd:field>
+ <fd:field id="lastname">
+ <fd:label>Lastname</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ <fd:field id="phone">
+ <fd:label>Phone</fd:label>
+ <fd:datatype base="string"/>
+ </fd:field>
+ <fd:field id="email">
+ <fd:label>Email</fd:label>
+ <fd:datatype base="string"/>
+ <fd:validation>
+ <fd:email/>
+ </fd:validation>
+ </fd:field>
+ <fd:field id="birthdate">
+ <fd:label>Birthdate (dd/MM/yyyy):</fd:label>
+ <fd:datatype base="date">
+ <fd:convertor>
+ <fd:patterns>
+ <fd:pattern>dd/MM/yyyy</fd:pattern>
+ </fd:patterns>
+ </fd:convertor>
+ </fd:datatype>
+ </fd:field>
+ <fd:booleanfield id="select">
+ <fd:label>Select</fd:label>
+ </fd:booleanfield>
+ </fd:widgets>
+ </fd:repeater>
+ -->
</fd:widgets>
</fd:form>
Modified: cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml?rev=267441&r1=267440&r2=267441&view=diff
==============================================================================
--- cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml (original)
+++ cocoon/gsoc/mpfingsthorn/forms/samples/library/forms/form1_template.xml Sat Sep 3 02:29:21 2005
@@ -16,7 +16,7 @@
-->
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
- <title>Registration</title>
+ <title>Form libraries sample</title>
<content>
<ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
<fi:group>
@@ -25,10 +25,61 @@
<ft:widget id="field1"/>
<ft:widget id="field1-2"/>
<ft:widget id="field2"/>
- <ft:widget id="field3"/>
+ <ft:widget id="myField3"/>
+ <ft:widget id="myField4"/>
+ <ft:widget id="myField5"/>
+ <ft:widget id="myBeer"/>
+ <ft:widget id="myEmail"/>
+ <ft:widget id="myAccount"/>
+ <ft:widget id="myAccount1"/>
</fi:items>
</fi:group>
+
+ <!--
+ <ft:widget-label id="contacts"/><br/>
+ <ft:repeater-size id="contacts"/>
+ <table border="1">
+ <tr>
+ <th><ft:repeater-widget-label id="contacts" widget-id="firstname"/></th>
+ <th><ft:repeater-widget-label id="contacts" widget-id="lastname"/></th>
+ <th><ft:repeater-widget-label id="contacts" widget-id="phone"/></th>
+ <th><ft:repeater-widget-label id="contacts" widget-id="email"/></th>
+ <th><ft:repeater-widget-label id="contacts" widget-id="birthdate"/></th>
+ <th><ft:repeater-widget-label id="contacts" widget-id="select"/></th>
+ </tr>
+ <jx:choose>
+ <jx:when test="${widget.getChild('contacts').getSize() == 0}">
+ <tr><td colspan="6" align="center"><em>There are no contacts to display</em></td></tr>
+ </jx:when>
+ <jx:otherwise>
+ <ft:repeater-widget id="contacts">
+ <tr>
+ <td><ft:widget id="firstname"/></td>
+ <td><ft:widget id="lastname"/></td>
+ <td><ft:widget id="phone"/></td>
+ <td><ft:widget id="email"/></td>
+ <td><ft:widget id="birthdate"/></td>
+ <td><ft:widget id="select"/></td>
+ </tr>
+ </ft:repeater-widget>
+ </jx:otherwise>
+ </jx:choose>
+ <tr>
+ <td colspan="6">
+ <ft:widget id="addcontact"/>
+ <jx:if test="${widget.getChild('contacts').getSize() > 0}">
+ <ft:widget id="removecontacts"/>
+ <br/>
+ <small>Hint: remove all contacts to see how dynamic form templates can change
+ their layout depending on widget values</small>
+ </jx:if>
+ </td>
+ </tr>
+ </table>
+ -->
+
<input type="submit"/>
+
</ft:form-template>
</content>
</page>