cis 375—web app dev ii xforms. 2 introduction to xforms xforms are the next generation of html...
TRANSCRIPT
CIS 375—Web App Dev II
XForms
2
Introduction to XForms XForms
are the next generation of HTML forms are richer and more flexible than HTML forms are designed to handle interactive transactions are platform and device _____________ separate data and logic from presentation use ______ to define forms and transport data contain features like calculations and validations of forms can be routed to multiple users and locations
XForms 1.0 became a W3C _______________ in October 2003, but implementation is not widespread.
Here’s an online book covering XForms.
3
HTML Form Example<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>
4
XForms Example
<?xml version="1.0" encoding="UTF-8"?>
<example xml:lang="en"xmlns:xforms="http://www.w3.org/2002/xforms/cr>
<head> <xforms:model> <xforms:instance> <ecommerce xmlns=""> <method/> <number/> <expiry/> </ecommerce> </xforms:instance> <xforms:submission action =
"http://www.w3schools.com/submit" method="post" id="submit" includenamespaceprefixes=""/>
</xforms:model> </head>
<body> <xforms:select1 ref="method">
<xforms:label>Select Payment Method:</xforms:label>
<xforms:item> <xforms:label>Cash</xforms:label> <xforms:value>cash</xforms:value> </xforms:item>
<xforms:item> <xforms:label>Credit</xforms:label> <xforms:value>cc</xforms:value> </xforms:item> </xforms:select1>
<xforms:input ref="number"> <xforms:label>Credit Card
Number:</xforms:label> </xforms:input>
<xforms:input ref="expiry"> <xforms:label>Expiration
Date:</xforms:label> </xforms:input>
<xforms:submit submission="submit"> <xforms:label>Submit</xforms:label> </xforms:submit> </body></example>
5
A Novell Implementationhttp://developer.novell.com/xforms/#preview
6
XForms Example Implemented
7
Comments About XForms More complicated, but more functional and
device independent. Notice the following about the markup example:
The user interface is not hard-coded to use radio buttons
Form controls always have _______ There is no need for an enclosing form element
The data will be submitted as _____:<ecommerce>
<method>cc</method> <number>4535464489044345</number>
<expiry>2005-07</expiry>
</ecommerce>
8
XForms Data Types & Functions
The XForms specification contains many predefined data types, such as xs:string A string (this is the default datatype ) xs:date Defines a date value xs:time Defines a time value xs:decimal Defines a decimal value
XForms have some predefined functions (but you can also call functions defined in _______), such as boolean-from-string(string) if(booleantest, string1, string2) avg(node-set) days-from-date(string)