HOME

XForms Tutorial
XForms HOME
XForms Intro
XForms in XHTML
XForms DataTypes
XForms Functions

Resources
XForms Resources

Please visit our sponsors !

XForms Data Types

prev next

XForms have predefined data types and attributes.


Data Types

Data Type Example Input Result
binary <binary name="image"/> <image>photo.jpg</image>
boolean <boolean name="member"/> <member>false</member>
date <date name="orderdate"/> <orderdate>2000-04-18</orderdate>
duration <duration name="duration"/> <duration>2</duration>
group <group name="order">
   <string name="item"/>
   <number name="quantity"/>
</group>
<order>
   <item>milk</item>
   <quantity>10</quantity>
</order>
money <money name="price"/> <price>99.95</price>
number <number name="quantity"/> <quantity>40</quantity>
string <string name="country"/> <country>Norway</country>
time <time name="ordertime"/> <ordertime>18:10:30</ordertime>
uri <uri name="site"/> <site>http://www.w3schools.com</site>


Data Attributes

Attributes Purpose Example
currency Defines the currency <money name="price" currency="usd"/>
decimal Defines the number of decimals <number name="price" decimal="2"/>
integer Defines the value as an integer <number name="age" integer="true"/>
maxOccurs Defines the max number of values for the same data <string name="orderline" maxOccurs="*">
minOccurs Defines the min number of values for the same data <string name="orderline" minOccurs="1">
name Defines the name of the data <string name="country"/>
precision Defines the precision of the value <date name="yearborn" precision="year"/>


Validation Attributes

Attributes Purpose Example
calc The value is calculated <money name="total" calc=sum(total,price*quantity)/>
default  The value has a default <string name="country" default="Norway"/>
fixed The value is fixed <string name="country" fixed="Norway"/>
min The minimum value <number name="age" min="16"
max The maximum value <number name="age" max="65"
pattern Pattern validation <string name="phone" pattern="\d*-\d*-\d*"
range The value is in a range <string name="sex" range="closed">
<value>male</value>
<value>female</value>
</string>
required The value is required <string name="age" required="true"/>
validate The value should be validated <number name="zip" validate="valzip(this.value)"/>


Data Structures

Data Type Purpose Example
enum Values must be from a predefined enumeration <string name="sex" range="closed">
  <value>male</value>
  <value>female</value>
</string>
union Values must be from one of two different sets <union name="sex">
   <string range="closed">
      <value>male</value>
      <value>female</value>
   </string>
   <number range="closed">
      <value>1</value>
      <value>2</value>
   </number>
</union>


prev next

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

Domain Name Registration
Domain Name
Registration & More!



Your own Web Site?

Read W3Schools
Hosting Tutorial



ASP Hosting
ASP.net Hosting
Web Hosting



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

Books Online

Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search