| <?xml version="1.0"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <fd:form |
| xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" |
| xmlns:i18n="http://apache.org/cocoon/i18n/2.1"> |
| |
| <fd:widgets> |
| <fd:field id="email" required="true"> |
| <fd:datatype base="string"> |
| <fd:validation> |
| <fd:email/> |
| </fd:validation> |
| </fd:datatype> |
| <fd:label>Enter an <b>email</b> address:</fd:label> |
| </fd:field> |
| |
| <fd:aggregatefield id="phone" required="true"> |
| <fd:label>Enter a phone number in \+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7}) format</fd:label> |
| <fd:datatype base="string"/> |
| <fd:split pattern="\+([0-9]{1,3})-([0-9]{1,4})-([0-9]{5,7})"> |
| <fd:map group="1" field="cntr"/> |
| <fd:map group="2" field="zone"/> |
| <fd:map group="3" field="number"/> |
| <fd:failmessage>The phone-number format is wrong, please try again |
| </fd:failmessage> |
| </fd:split> |
| <fd:combine expression='Concat("+", cntr, "-", zone, "-", number)'/> |
| <fd:widgets> |
| <fd:field id="cntr"> |
| <fd:datatype base="string"/> |
| </fd:field> |
| <fd:field id="zone"> |
| <fd:datatype base="string"/> |
| </fd:field> |
| <fd:field id="number"> |
| <fd:datatype base="string"/> |
| </fd:field> |
| </fd:widgets> |
| </fd:aggregatefield> |
| |
| <fd:field id="ipaddress"> |
| <fd:label>Please enter your IP address</fd:label> |
| <fd:datatype base="string"> |
| <fd:validation> |
| <fd: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])$"> |
| <fd:failmessage>Invalid IP address.</fd:failmessage> |
| </fd:regexp> |
| </fd:validation> |
| </fd:datatype> |
| </fd:field> |
| |
| <fd:field id="birthday" required="true"> |
| <fd:label>Your birthday (dd/MM/yyyy):</fd:label> |
| <fd:datatype base="date"> |
| <fd:convertor> |
| <fd:patterns> |
| <fd:pattern>dd/MM/yyyy</fd:pattern> |
| <!-- The above pattern is a non-locale-specific pattern. You can |
| also add locale-specific patterns by adding more fd:pattern elements |
| here, with a locale attribute on them. --> |
| </fd:patterns> |
| </fd:convertor> |
| </fd:datatype> |
| </fd:field> |
| |
| <fd:field id="number" required="true"> |
| <fd:label>Select a number:</fd:label> |
| <fd:datatype base="integer"/> |
| <fd:selection-list> |
| <fd:item value="1"/> |
| <fd:item value="2"/> |
| <fd:item value="3"/> |
| <fd:item value="4"/> |
| <fd:item value="5"/> |
| </fd:selection-list> |
| </fd:field> |
| |
| <fd:booleanfield id="choose"> |
| <fd:label>I choose</fd:label> |
| </fd:booleanfield> |
| |
| <fd:field id="sex"> |
| <fd:label>Sex</fd:label> |
| <fd:datatype base="enum"> |
| <fd:convertor type="enum"> |
| <fd:enum>org.apache.cocoon.forms.samples.Sex</fd:enum> |
| </fd:convertor> |
| </fd:datatype> |
| <fd:selection-list type="enum" class="org.apache.cocoon.forms.samples.Sex"/> |
| </fd:field> |
| |
| <fd:multivaluefield id="drinks"> |
| <fd:label>Indicate which 2 of the following drinks you'd like to receive:</fd:label> |
| <fd:datatype base="string"/> |
| <fd:validation> |
| <fd:value-count exact="2"/> |
| </fd:validation> |
| <fd:selection-list> |
| <fd:item value="Maes"/> |
| <fd:item value="Jupiler"/> |
| <fd:item value="Leffe"/> |
| <fd:item value="Hoegaarden"/> |
| <fd:item value="Coca Cola"/> |
| </fd:selection-list> |
| </fd:multivaluefield> |
| |
| <fd:repeater id="contacts"> |
| <fd:widgets> |
| <fd:output id="id"> |
| <fd:datatype base="long"/> |
| </fd:output> |
| <fd:field id="firstname"> |
| <fd:label>Firstname</fd:label> |
| <fd:datatype base="string"/> |
| </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:datatype> |
| </fd:field> |
| <fd:booleanfield id="select"> |
| <fd:label>Select</fd:label> |
| </fd:booleanfield> |
| </fd:widgets> |
| </fd:repeater> |
| |
| <fd:repeater-action id="addcontact" action-command="add-row" repeater="contacts"> |
| <fd:label>Add contact</fd:label> |
| </fd:repeater-action> |
| |
| <fd:repeater-action id="removecontacts" action-command="delete-rows" repeater="contacts" select="select"> |
| <fd:label>Remove selected contacts</fd:label> |
| </fd:repeater-action> |
| </fd:widgets> |
| |
| </fd:form> |