You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2003/11/01 21:09:13 UTC
cvs commit: cocoon-2.1/src/blocks/woody/samples/forms carselector_form.xml form1.xml form2_model.xml registration.xml
bruno 2003/11/01 12:09:13
Modified: src/blocks/woody/samples/forms carselector_form.xml
form1.xml form2_model.xml registration.xml
Log:
Child widget definitions are now located inside a wd:widgets element.
Revision Changes Path
1.4 +98 -99 cocoon-2.1/src/blocks/woody/samples/forms/carselector_form.xml
Index: carselector_form.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/carselector_form.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- carselector_form.xml 25 Sep 2003 17:37:30 -0000 1.3
+++ carselector_form.xml 1 Nov 2003 20:09:13 -0000 1.4
@@ -4,110 +4,109 @@
xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
- <wd:field id="make" required="true">
- <wd:label>Make:</wd:label>
- <wd:datatype base="string"/>
- <wd:selection-list src="cocoon:/cars" dynamic="true"/>
- <wd:on-value-changed>
- <javascript>
- java.lang.System.err.println("maker changed from " + event.oldValue + " to " + event.newValue);
- var value = event.source.value;
- var typewidget = event.source.parent.getWidget("type");
- if (value != null) {
- // Get the corresponding type list
- typewidget.setSelectionList("cocoon:/cars/" + value);
- } else {
- // Reset the value (will clear validation error)
- event.source.setValue(null);
- // Set an empty selection list
- typewidget.setSelectionList(new Packages.org.apache.cocoon.woody.datatype.EmptySelectionList("Select a maker first"));
- }
- // Always set the type value to null. Note that it will also fire an event on the "type"
- // widget if it already had a value.
- typewidget.setValue(null);
-
- // Fun with messages...
- var msg = event.source.parent.getWidget("message");
- if (value == null) {
- msg.value = "Yep. Choosing a maker is not that easy...";
- } else {
- if (event.oldValue == null) {
- msg.value = "Good. " + value + " makes good cars!";
+ <wd:widgets>
+ <wd:field id="make" required="true">
+ <wd:label>Make:</wd:label>
+ <wd:datatype base="string"/>
+ <wd:selection-list src="cocoon:/cars" dynamic="true"/>
+ <wd:on-value-changed>
+ <javascript>
+ java.lang.System.err.println("maker changed from " + event.oldValue + " to " + event.newValue);
+ var value = event.source.value;
+ var typewidget = event.source.parent.getWidget("type");
+ if (value != null) {
+ // Get the corresponding type list
+ typewidget.setSelectionList("cocoon:/cars/" + value);
} else {
- msg.value = "Why not? " + value + " also makes good cars!";
+ // Reset the value (will clear validation error)
+ event.source.setValue(null);
+ // Set an empty selection list
+ typewidget.setSelectionList(new Packages.org.apache.cocoon.woody.datatype.EmptySelectionList("Select a maker first"));
}
- }
- </javascript>
- </wd:on-value-changed>
- </wd:field>
-
- <wd:field id="type" required="true">
- <wd:label>Type:</wd:label>
- <wd:datatype base="string"/>
- <wd:selection-list>
- <wd:item value="">
- <wd:label>Select a maker first</wd:label>
- </wd:item>
- </wd:selection-list>
- <wd:on-value-changed>
- <javascript>
- java.lang.System.err.println("type changed to " + event.source.value);
- var value = event.source.value;
- var modelwidget = event.source.parent.getWidget("model");
- var makewidget = event.source.parent.getWidget("make");
- if (value != null) {
- modelwidget.setSelectionList("cocoon:/cars/" + makewidget.value + "/" + value);
- } else {
- // Reset the value (will clear validation error)
- event.source.setValue(null);
- // Set an empty selection list
- modelwidget.setSelectionList(new Packages.org.apache.cocoon.woody.datatype.EmptySelectionList("Select a type first"));
- }
-
- // Always set the model value to null. Note that it will also fire an event on the "model"
- // widget if it already had a value.
- modelwidget.setValue(null);
-
- // Fun with messages...
- if (value != null) {
+ // Always set the type value to null. Note that it will also fire an event on the "type"
+ // widget if it already had a value.
+ typewidget.setValue(null);
+
+ // Fun with messages...
var msg = event.source.parent.getWidget("message");
- if (event.oldValue == null) {
- msg.value = "A " + makewidget.value + " " + value + " is a very good choice.";
+ if (value == null) {
+ msg.value = "Yep. Choosing a maker is not that easy...";
} else {
- msg.value = "So you prefer a " + value + " ?";
+ if (event.oldValue == null) {
+ msg.value = "Good. " + value + " makes good cars!";
+ } else {
+ msg.value = "Why not? " + value + " also makes good cars!";
+ }
}
- }
- </javascript>
- </wd:on-value-changed>
- </wd:field>
+ </javascript>
+ </wd:on-value-changed>
+ </wd:field>
- <wd:field id="model" required="true">
- <wd:label>Model:</wd:label>
- <wd:datatype base="string"/>
- <wd:selection-list>
- <wd:item value="">
- <wd:label>Select a type first</wd:label>
- </wd:item>
- </wd:selection-list>
- <wd:on-value-changed>
- <javascript>
- var value = event.source.value;
- if (value != null) {
- event.source.parent.getWidget("message").setValue("Model " + value + " is a great car!");
- } else {
- // Reset value
- event.source.value = null;
- }
- </javascript>
- </wd:on-value-changed>
- </wd:field>
-
- <wd:output id="message">
- <wd:datatype base="string"/>
- </wd:output>
-
- <!--wd:action id="updatemodels" action-command="updatemodels">
- <wd:label>Update models</wd:label>
- </wd:action-->
+ <wd:field id="type" required="true">
+ <wd:label>Type:</wd:label>
+ <wd:datatype base="string"/>
+ <wd:selection-list>
+ <wd:item value="">
+ <wd:label>Select a maker first</wd:label>
+ </wd:item>
+ </wd:selection-list>
+ <wd:on-value-changed>
+ <javascript>
+ java.lang.System.err.println("type changed to " + event.source.value);
+ var value = event.source.value;
+ var modelwidget = event.source.parent.getWidget("model");
+ var makewidget = event.source.parent.getWidget("make");
+ if (value != null) {
+ modelwidget.setSelectionList("cocoon:/cars/" + makewidget.value + "/" + value);
+ } else {
+ // Reset the value (will clear validation error)
+ event.source.setValue(null);
+ // Set an empty selection list
+ modelwidget.setSelectionList(new Packages.org.apache.cocoon.woody.datatype.EmptySelectionList("Select a type first"));
+ }
+
+ // Always set the model value to null. Note that it will also fire an event on the "model"
+ // widget if it already had a value.
+ modelwidget.setValue(null);
+
+ // Fun with messages...
+ if (value != null) {
+ var msg = event.source.parent.getWidget("message");
+ if (event.oldValue == null) {
+ msg.value = "A " + makewidget.value + " " + value + " is a very good choice.";
+ } else {
+ msg.value = "So you prefer a " + value + " ?";
+ }
+ }
+ </javascript>
+ </wd:on-value-changed>
+ </wd:field>
+
+ <wd:field id="model" required="true">
+ <wd:label>Model:</wd:label>
+ <wd:datatype base="string"/>
+ <wd:selection-list>
+ <wd:item value="">
+ <wd:label>Select a type first</wd:label>
+ </wd:item>
+ </wd:selection-list>
+ <wd:on-value-changed>
+ <javascript>
+ var value = event.source.value;
+ if (value != null) {
+ event.source.parent.getWidget("message").setValue("Model " + value + " is a great car!");
+ } else {
+ // Reset value
+ event.source.value = null;
+ }
+ </javascript>
+ </wd:on-value-changed>
+ </wd:field>
+
+ <wd:output id="message">
+ <wd:datatype base="string"/>
+ </wd:output>
+
+ </wd:widgets>
</wd:form>
1.15 +220 -216 cocoon-2.1/src/blocks/woody/samples/forms/form1.xml
Index: form1.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form1.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- form1.xml 25 Sep 2003 17:37:30 -0000 1.14
+++ form1.xml 1 Nov 2003 20:09:13 -0000 1.15
@@ -3,230 +3,234 @@
xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
- <wd:field id="tab-state">
- <wd:datatype base="string"/>
- </wd:field>
-
- <wd:field id="email" required="true">
- <wd:datatype base="string">
- <wd:validation>
- <wd:email/>
- </wd:validation>
- </wd:datatype>
- <wd:label>Enter an <b>email</b> address:</wd:label>
- </wd:field>
-
- <wd:booleanfield id="somebool">
- <wd:label>Put me <em>on</em> or <em>off</em>.</wd:label>
- </wd:booleanfield>
-
- <wd:field id="fourchars">
- <wd:label>Select something that's 4 characters long:</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:length exact='2*2'/>
- </wd:validation>
- </wd:datatype>
- <wd:selection-list src="forms/a-choices.xml"/>
- </wd:field>
-
- <wd:field id="account">
- <wd:label>Indicate the size of your bank account (in m<sup>3</sup>):</wd:label>
- <wd:datatype base="long"/>
- <wd:selection-list>
- <wd:item value="1"/>
- <wd:item value="2"/>
- <wd:item value="3">
- <wd:label>three</wd:label>
- </wd:item>
- <wd:item value="4"/>
- <wd:item value="5"/>
- </wd:selection-list>
- </wd:field>
-
- <wd:field id="cowheight">
- <wd:label>Indicate your height (in cows):</wd:label>
- <wd:datatype base="long"/>
- <wd:selection-list>
- <wd:item value="1"/>
- <wd:item value="2"/>
- <wd:item value="3">
- <wd:label>three</wd:label>
- </wd:item>
- <wd:item value="4"/>
- <wd:item value="5"/>
- </wd:selection-list>
- </wd:field>
-
- <wd:field id="number1" required="true">
- <wd:label>Please enter a number<br/>
- <small>(will automatically set a correct value below if needed)</small>:</wd:label>
- <wd:datatype base="long"/>
- <wd:on-value-changed>
- <javascript>
- java.lang.System.err.println("Was here!");
- var newValue = event.source.value;
- if (newValue != null) {
- var number2 = event.source.parent.getWidget("number2");
- if (number2.value == null) {
- number2.setValue(new java.lang.Long(newValue.intValue() + 1));
- }
- }
- </javascript>
- </wd:on-value-changed>
- </wd:field>
-
- <wd:field id="number2" required="true">
- <wd:label>Enter another number, larger than the other number:</wd:label>
- <wd:datatype base="long">
- <wd:validation>
- <wd:range min="number1 + 1">
- <wd:failmessage>This number should be larger than the first number.</wd:failmessage>
- </wd:range>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:multivaluefield id="drinks">
- <wd:label>Indicate which 2 of the following drinks you'd like to receive:</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:value-count exact="2"/>
- </wd:validation>
- </wd:datatype>
- <wd:selection-list>
- <wd:item value="Maes"/>
- <wd:item value="Jupiler"/>
- <wd:item value="Leffe"/>
- <wd:item value="Hoegaarden"/>
- <wd:item value="Coca Cola"/>
- </wd:selection-list>
- </wd:multivaluefield>
-
- <wd:aggregatefield id="visa" required="true">
- <wd:label>Enter your (16-digit) visa number (without spaces)
- <br/>Your credit card will be billed.
- <br/><small>Valid test number is: 4111111111111111</small></wd:label>
- <wd:split pattern="([0-9]{4})([0-9]{4})([0-9]{4})([0-9]{4})">
- <wd:map group="1" field="part1"/>
- <wd:map group="2" field="part2"/>
- <wd:map group="3" field="part3"/>
- <wd:map group="4" field="part4"/>
- <wd:failmessage>Not a valid 16-digit visa number.</wd:failmessage>
- </wd:split>
- <wd:combine expression='Concat(part1,part2,part3,part4)'/>
- <wd:children>
- <wd:field id="part1">
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="part2">
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="part3">
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="part4">
- <wd:datatype base="string"/>
- </wd:field>
- </wd:children>
- <wd:validation>
- <wd:mod10>
- <wd:failmessage>Invalid credit card number.</wd:failmessage>
- </wd:mod10>
- </wd:validation>
- </wd:aggregatefield>
-
- <wd:field id="ipaddress" required="true">
- <wd:label>Please enter your IP address</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:regexp pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$">
- <wd:failmessage>Invalid IP address.</wd:failmessage>
- </wd:regexp>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="birthdate" required="true">
- <wd:label>Your birthdate (dd/MM/yyyy):</wd:label>
- <wd:datatype base="date">
- <wd:convertor>
- <wd:patterns>
- <wd:pattern>dd/MM/yyyy</wd:pattern>
- <!-- The above pattern is a non-locale-specific pattern. You can
- also add locale-specific patterns by adding more wd:pattern elements
- here, with a locale attribute on them. -->
- </wd:patterns>
- </wd:convertor>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="altbirthdate" required="true">
- <wd:label>Select a date on which you'd rather had been born:</wd:label>
- <wd:datatype base="date">
- <wd:convertor variant="date" style="full"/>
- </wd:datatype>
- <wd:selection-list>
- <!-- The convertor element here is used to specify how the values
- in the value attributes of the wd:item elements should be
- interpreted. -->
- <wd:convertor type="formatting">
- <wd:patterns>
- <wd:pattern>yyyyMMdd</wd:pattern>
- </wd:patterns>
- </wd:convertor>
- <wd:item value="13020711"/>
- <wd:item value="19120623"/>
- <wd:item value="19690721"/>
- <wd:item value="19700506"/>
- <wd:item value="19781014"/>
- <wd:item value="20010911"/>
- </wd:selection-list>
- </wd:field>
-
- <wd:field id="dieselprice" required="true">
- <wd:label>Price for a liter diesel:</wd:label>
- <wd:datatype base="decimal">
- <wd:convertor variant="number">
- <wd:patterns>
- <wd:pattern>#.00</wd:pattern>
- </wd:patterns>
- </wd:convertor>
- </wd:datatype>
- </wd:field>
-
- <wd:repeater id="contacts">
- <wd:field id="firstname">
- <wd:label>Firstname</wd:label>
+ <wd:widgets>
+ <wd:field id="tab-state">
<wd:datatype base="string"/>
</wd:field>
- <wd:field id="lastname">
- <wd:label>Lastname</wd:label>
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="phone">
- <wd:label>Phone</wd:label>
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="email">
- <wd:label>Email</wd:label>
+
+ <wd:field id="email" required="true">
<wd:datatype base="string">
<wd:validation>
<wd:email/>
</wd:validation>
</wd:datatype>
+ <wd:label>Enter an <b>email</b> address:</wd:label>
</wd:field>
- <wd:booleanfield id="select">
- <wd:label>Select</wd:label>
+
+ <wd:booleanfield id="somebool">
+ <wd:label>Put me <em>on</em> or <em>off</em>.</wd:label>
</wd:booleanfield>
- </wd:repeater>
-
- <wd:repeater-action id="addcontact" action-command="add-row" repeater="contacts">
- <wd:label>Add contact</wd:label>
- </wd:repeater-action>
-
- <wd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select">
- <wd:label>Remove selected contacts</wd:label>
- </wd:repeater-action>
+
+ <wd:field id="fourchars">
+ <wd:label>Select something that's 4 characters long:</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:length exact='2*2'/>
+ </wd:validation>
+ </wd:datatype>
+ <wd:selection-list src="forms/a-choices.xml"/>
+ </wd:field>
+
+ <wd:field id="account">
+ <wd:label>Indicate the size of your bank account (in m<sup>3</sup>):</wd:label>
+ <wd:datatype base="long"/>
+ <wd:selection-list>
+ <wd:item value="1"/>
+ <wd:item value="2"/>
+ <wd:item value="3">
+ <wd:label>three</wd:label>
+ </wd:item>
+ <wd:item value="4"/>
+ <wd:item value="5"/>
+ </wd:selection-list>
+ </wd:field>
+
+ <wd:field id="cowheight">
+ <wd:label>Indicate your height (in cows):</wd:label>
+ <wd:datatype base="long"/>
+ <wd:selection-list>
+ <wd:item value="1"/>
+ <wd:item value="2"/>
+ <wd:item value="3">
+ <wd:label>three</wd:label>
+ </wd:item>
+ <wd:item value="4"/>
+ <wd:item value="5"/>
+ </wd:selection-list>
+ </wd:field>
+
+ <wd:field id="number1" required="true">
+ <wd:label>Please enter a number<br/>
+ <small>(will automatically set a correct value below if needed)</small>:</wd:label>
+ <wd:datatype base="long"/>
+ <wd:on-value-changed>
+ <javascript>
+ java.lang.System.err.println("Was here!");
+ var newValue = event.source.value;
+ if (newValue != null) {
+ var number2 = event.source.parent.getWidget("number2");
+ if (number2.value == null) {
+ number2.setValue(new java.lang.Long(newValue.intValue() + 1));
+ }
+ }
+ </javascript>
+ </wd:on-value-changed>
+ </wd:field>
+
+ <wd:field id="number2" required="true">
+ <wd:label>Enter another number, larger than the other number:</wd:label>
+ <wd:datatype base="long">
+ <wd:validation>
+ <wd:range min="number1 + 1">
+ <wd:failmessage>This number should be larger than the first number.</wd:failmessage>
+ </wd:range>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:multivaluefield id="drinks">
+ <wd:label>Indicate which 2 of the following drinks you'd like to receive:</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:value-count exact="2"/>
+ </wd:validation>
+ </wd:datatype>
+ <wd:selection-list>
+ <wd:item value="Maes"/>
+ <wd:item value="Jupiler"/>
+ <wd:item value="Leffe"/>
+ <wd:item value="Hoegaarden"/>
+ <wd:item value="Coca Cola"/>
+ </wd:selection-list>
+ </wd:multivaluefield>
+
+ <wd:aggregatefield id="visa" required="true">
+ <wd:label>Enter your (16-digit) visa number (without spaces)
+ <br/>Your credit card will be billed.
+ <br/><small>Valid test number is: 4111111111111111</small></wd:label>
+ <wd:split pattern="([0-9]{4})([0-9]{4})([0-9]{4})([0-9]{4})">
+ <wd:map group="1" field="part1"/>
+ <wd:map group="2" field="part2"/>
+ <wd:map group="3" field="part3"/>
+ <wd:map group="4" field="part4"/>
+ <wd:failmessage>Not a valid 16-digit visa number.</wd:failmessage>
+ </wd:split>
+ <wd:combine expression='Concat(part1,part2,part3,part4)'/>
+ <wd:widgets>
+ <wd:field id="part1">
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="part2">
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="part3">
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="part4">
+ <wd:datatype base="string"/>
+ </wd:field>
+ </wd:widgets>
+ <wd:validation>
+ <wd:mod10>
+ <wd:failmessage>Invalid credit card number.</wd:failmessage>
+ </wd:mod10>
+ </wd:validation>
+ </wd:aggregatefield>
+
+ <wd:field id="ipaddress" required="true">
+ <wd:label>Please enter your IP address</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:regexp pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$">
+ <wd:failmessage>Invalid IP address.</wd:failmessage>
+ </wd:regexp>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="birthdate" required="true">
+ <wd:label>Your birthdate (dd/MM/yyyy):</wd:label>
+ <wd:datatype base="date">
+ <wd:convertor>
+ <wd:patterns>
+ <wd:pattern>dd/MM/yyyy</wd:pattern>
+ <!-- The above pattern is a non-locale-specific pattern. You can
+ also add locale-specific patterns by adding more wd:pattern elements
+ here, with a locale attribute on them. -->
+ </wd:patterns>
+ </wd:convertor>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="altbirthdate" required="true">
+ <wd:label>Select a date on which you'd rather had been born:</wd:label>
+ <wd:datatype base="date">
+ <wd:convertor variant="date" style="full"/>
+ </wd:datatype>
+ <wd:selection-list>
+ <!-- The convertor element here is used to specify how the values
+ in the value attributes of the wd:item elements should be
+ interpreted. -->
+ <wd:convertor type="formatting">
+ <wd:patterns>
+ <wd:pattern>yyyyMMdd</wd:pattern>
+ </wd:patterns>
+ </wd:convertor>
+ <wd:item value="13020711"/>
+ <wd:item value="19120623"/>
+ <wd:item value="19690721"/>
+ <wd:item value="19700506"/>
+ <wd:item value="19781014"/>
+ <wd:item value="20010911"/>
+ </wd:selection-list>
+ </wd:field>
+
+ <wd:field id="dieselprice" required="true">
+ <wd:label>Price for a liter diesel:</wd:label>
+ <wd:datatype base="decimal">
+ <wd:convertor variant="number">
+ <wd:patterns>
+ <wd:pattern>#.00</wd:pattern>
+ </wd:patterns>
+ </wd:convertor>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:repeater id="contacts">
+ <wd:widgets>
+ <wd:field id="firstname">
+ <wd:label>Firstname</wd:label>
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="lastname">
+ <wd:label>Lastname</wd:label>
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="phone">
+ <wd:label>Phone</wd:label>
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="email">
+ <wd:label>Email</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:email/>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+ <wd:booleanfield id="select">
+ <wd:label>Select</wd:label>
+ </wd:booleanfield>
+ </wd:widgets>
+ </wd:repeater>
+
+ <wd:repeater-action id="addcontact" action-command="add-row" repeater="contacts">
+ <wd:label>Add contact</wd:label>
+ </wd:repeater-action>
+
+ <wd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select">
+ <wd:label>Remove selected contacts</wd:label>
+ </wd:repeater-action>
+ </wd:widgets>
</wd:form>
1.9 +107 -103 cocoon-2.1/src/blocks/woody/samples/forms/form2_model.xml
Index: form2_model.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/form2_model.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- form2_model.xml 24 Sep 2003 20:47:07 -0000 1.8
+++ form2_model.xml 1 Nov 2003 20:09:13 -0000 1.9
@@ -3,116 +3,120 @@
xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
- <wd:field id="email" required="true">
- <wd:datatype base="string">
- <wd:validation>
- <wd:email/>
- </wd:validation>
- </wd:datatype>
- <wd:label>Enter an <b>email</b> address:</wd:label>
- </wd:field>
-
- <wd:aggregatefield id="phone" required="true">
- <wd:label>Enter a phone number in \+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7}) format</wd:label>
- <wd:split pattern="\+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7})">
- <wd:map group="1" field="cntr"/>
- <wd:map group="2" field="zone"/>
- <wd:map group="3" field="number"/>
- <wd:failmessage>The phone-number format is wrong, please try again
- </wd:failmessage>
- </wd:split>
- <wd:combine expression='Concat("+", cntr, "-", zone, "-", number)'/>
- <wd:children>
- <wd:field id="cntr">
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="zone">
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="number">
- <wd:datatype base="string"/>
- </wd:field>
- </wd:children>
- <wd:validation>
- </wd:validation>
- </wd:aggregatefield>
-
- <wd:field id="ipaddress">
- <wd:label>Please enter your IP address</wd:label>
- <wd:datatype base="string">
+ <wd:widgets>
+ <wd:field id="email" required="true">
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:email/>
+ </wd:validation>
+ </wd:datatype>
+ <wd:label>Enter an <b>email</b> address:</wd:label>
+ </wd:field>
+
+ <wd:aggregatefield id="phone" required="true">
+ <wd:label>Enter a phone number in \+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7}) format</wd:label>
+ <wd:split pattern="\+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7})">
+ <wd:map group="1" field="cntr"/>
+ <wd:map group="2" field="zone"/>
+ <wd:map group="3" field="number"/>
+ <wd:failmessage>The phone-number format is wrong, please try again
+ </wd:failmessage>
+ </wd:split>
+ <wd:combine expression='Concat("+", cntr, "-", zone, "-", number)'/>
+ <wd:widgets>
+ <wd:field id="cntr">
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="zone">
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="number">
+ <wd:datatype base="string"/>
+ </wd:field>
+ </wd:widgets>
<wd:validation>
- <wd:regexp pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$">
- <wd:failmessage>Invalid IP address.</wd:failmessage>
- </wd:regexp>
</wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="birthday" required="true">
- <wd:label>Your birthday (dd/MM/yyyy):</wd:label>
- <wd:datatype base="date">
- <wd:convertor>
- <wd:patterns>
- <wd:pattern>dd/MM/yyyy</wd:pattern>
- <!-- The above pattern is a non-locale-specific pattern. You can
- also add locale-specific patterns by adding more wd:pattern elements
- here, with a locale attribute on them. -->
- </wd:patterns>
- </wd:convertor>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="number" required="true">
- <wd:label>Select a number:</wd:label>
- <wd:datatype base="long"/>
- <wd:selection-list>
- <wd:item value="1"/>
- <wd:item value="2"/>
- <wd:item value="3"/>
- <wd:item value="4"/>
- <wd:item value="5"/>
- </wd:selection-list>
- </wd:field>
-
- <wd:booleanfield id="choose">
- <wd:label>I choose</wd:label>
- </wd:booleanfield>
-
- <wd:repeater id="contacts">
- <wd:output id="id">
- <wd:datatype base="long"/>
- </wd:output>
- <wd:field id="firstname">
- <wd:label>Firstname</wd:label>
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="lastname">
- <wd:label>Lastname</wd:label>
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="phone">
- <wd:label>Phone</wd:label>
- <wd:datatype base="string"/>
- </wd:field>
- <wd:field id="email">
- <wd:label>Email</wd:label>
+ </wd:aggregatefield>
+
+ <wd:field id="ipaddress">
+ <wd:label>Please enter your IP address</wd:label>
<wd:datatype base="string">
<wd:validation>
- <wd:email/>
+ <wd:regexp pattern="^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$">
+ <wd:failmessage>Invalid IP address.</wd:failmessage>
+ </wd:regexp>
</wd:validation>
</wd:datatype>
</wd:field>
- <wd:booleanfield id="select">
- <wd:label>Select</wd:label>
+
+ <wd:field id="birthday" required="true">
+ <wd:label>Your birthday (dd/MM/yyyy):</wd:label>
+ <wd:datatype base="date">
+ <wd:convertor>
+ <wd:patterns>
+ <wd:pattern>dd/MM/yyyy</wd:pattern>
+ <!-- The above pattern is a non-locale-specific pattern. You can
+ also add locale-specific patterns by adding more wd:pattern elements
+ here, with a locale attribute on them. -->
+ </wd:patterns>
+ </wd:convertor>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="number" required="true">
+ <wd:label>Select a number:</wd:label>
+ <wd:datatype base="long"/>
+ <wd:selection-list>
+ <wd:item value="1"/>
+ <wd:item value="2"/>
+ <wd:item value="3"/>
+ <wd:item value="4"/>
+ <wd:item value="5"/>
+ </wd:selection-list>
+ </wd:field>
+
+ <wd:booleanfield id="choose">
+ <wd:label>I choose</wd:label>
</wd:booleanfield>
- </wd:repeater>
-
- <wd:repeater-action id="addcontact" action-command="add-row" repeater="contacts">
- <wd:label>Add contact</wd:label>
- </wd:repeater-action>
-
- <wd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select">
- <wd:label>Remove selected contacts</wd:label>
- </wd:repeater-action>
+
+ <wd:repeater id="contacts">
+ <wd:widgets>
+ <wd:output id="id">
+ <wd:datatype base="long"/>
+ </wd:output>
+ <wd:field id="firstname">
+ <wd:label>Firstname</wd:label>
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="lastname">
+ <wd:label>Lastname</wd:label>
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="phone">
+ <wd:label>Phone</wd:label>
+ <wd:datatype base="string"/>
+ </wd:field>
+ <wd:field id="email">
+ <wd:label>Email</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:email/>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+ <wd:booleanfield id="select">
+ <wd:label>Select</wd:label>
+ </wd:booleanfield>
+ </wd:widgets>
+ </wd:repeater>
+
+ <wd:repeater-action id="addcontact" action-command="add-row" repeater="contacts">
+ <wd:label>Add contact</wd:label>
+ </wd:repeater-action>
+
+ <wd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select">
+ <wd:label>Remove selected contacts</wd:label>
+ </wd:repeater-action>
+ </wd:widgets>
</wd:form>
1.3 +52 -50 cocoon-2.1/src/blocks/woody/samples/forms/registration.xml
Index: registration.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/registration.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- registration.xml 30 Apr 2003 08:38:45 -0000 1.2
+++ registration.xml 1 Nov 2003 20:09:13 -0000 1.3
@@ -3,55 +3,57 @@
xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
- <wd:field id="name" required="true">
- <wd:label>Name:</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:length min="2"/>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="email" required="true">
- <wd:label>Email address:</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:email/>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="age">
- <wd:label>Your age:</wd:label>
- <wd:datatype base="long">
- <wd:validation>
- <wd:range min="0" max="150"/>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="password" required="true">
- <wd:label>Password:</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:length min="5" max="20"/>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:field id="confirmPassword" required="true">
- <wd:label>Re-enter password:</wd:label>
- <wd:datatype base="string">
- <wd:validation>
- <wd:assert test="password = confirmPassword">
- <wd:failmessage>The two passwords are not equal.</wd:failmessage>
- </wd:assert>
- </wd:validation>
- </wd:datatype>
- </wd:field>
-
- <wd:booleanfield id="spam">
- <wd:label>Send me spam</wd:label>
- </wd:booleanfield>
+ <wd:widgets>
+ <wd:field id="name" required="true">
+ <wd:label>Name:</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:length min="2"/>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="email" required="true">
+ <wd:label>Email address:</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:email/>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="age">
+ <wd:label>Your age:</wd:label>
+ <wd:datatype base="long">
+ <wd:validation>
+ <wd:range min="0" max="150"/>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="password" required="true">
+ <wd:label>Password:</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:length min="5" max="20"/>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:field id="confirmPassword" required="true">
+ <wd:label>Re-enter password:</wd:label>
+ <wd:datatype base="string">
+ <wd:validation>
+ <wd:assert test="password = confirmPassword">
+ <wd:failmessage>The two passwords are not equal.</wd:failmessage>
+ </wd:assert>
+ </wd:validation>
+ </wd:datatype>
+ </wd:field>
+
+ <wd:booleanfield id="spam">
+ <wd:label>Send me spam</wd:label>
+ </wd:booleanfield>
+ </wd:widgets>
</wd:form>