<html>
<body>
<form action="payment.asp" method="post">
<p><b>Select Payment Method</b></p>
<p>
Cash
<input type="radio" name="as" value="cash" />
Credit Card
<input type="radio" name="as" value="credit" checked />
</p>
<p>Card Number:<br />
<input type="text" id="cc" /></p>
<p>Expiration Date:<br />
<input type="text" name="exp" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xform="http://www.w3.org/2001/08/xforms">
<head>
<xform:xform id="payment">
<xform:submitInfo action="submit.asp" method="post"/>
</xform:xform>
<xform:instance>.....</xform:instance>
<xform:model>........</xform:model>
<xform:bindings>.....</xform:bindings>
</head>
<body>
<xform:selectOne xform="payment" ref="as" >
<xform:caption>Select Payment Method</xform:caption>
<xform:choices>
<xform:item value="cash">
<xform:caption>Cash</xform:caption></xform:item>
<xform:item value="credit">
<xform:caption>Credit</xform:caption></xform:item>
</xform:choices>
</xform:selectOne>
<xform:input xform="payment" ref="cc">
<xform:caption>Credit Card Number</xform:caption>
</xform:input>
<xform:input xform="payment" ref="exp">
<xform:caption>Expiration Date</xform:caption>
</xform:input>
<xform:submit xform="payment">
<xform:caption>Submit</xform:caption>
</xform:submit>
</body>
</html>
<money name="price" currency="usd" />
<string name="country" default="Norway" />
<string name="phone" pattern="\d*-\d*-\d*" />
number name="age" min="16" />
<envelope>
<body>
<as>Credit</as>
<cc>123547789012345</cc>
<exp>2001-08</exp>
</body>
</envelope>
| 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> |
| Attribute | 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 integer | <number name="age" integer="true" /> |
| maxOccurs | Defines the max number of values
for the same data |
<string name="orderline" maxOccurs="1" /> |
| 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" precisiion="year" /> |
| Attribute | 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)" /> |
| Type | Example | Input Result |
|---|---|---|
| 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 name="sex" range="closed">     <value>male</value>     <value>female</value>   </string>   <string name="sex" range="closed">     <value>male</value>     <value>female</value>   </string> </union> |
| Function | Description | Example | Result |
|---|---|---|---|
| substring(string,n,m) | Returns a substring of string
from position n to m |
substring("Hello",0,2) | "He" |
| strlen(string) | Length of a string | strlen("Hello World") | 11 |
| Function | Description | Example |
|---|---|---|
| sum(element,expression) | Computes the expression and
assigns it to the element |
sum(total,price*quantity) |
| Function | Description | Example |
|---|---|---|
| apr | Returns the annual percentage rate for a loan
n1 = the loan n2 = monthly payment n3 = # of payment months |
annualP=apr(50000,500,120) |
|
|
|