Title: The Freedom to Achieve
1The Freedom to Achieve
Independent, Open Solutions for Business and
Government www.platinumsolutions.com
2Forming Good HabitsA Gentle Introduction To
XForms The Future Of Forms On The Web
Northern Virginia Java Users Group
(NOVAJUG) February 22, 2005 600pm -
900pm Presented by Brian Rosenthal Manager,
PlatinumSolutions brian.rosenthal_at_platinumsolution
s.com
3Who Am I
- Web apps developer since 1996
- Working with Java since 1998
- Working with XML Since 2000
- Manager PlatinumSolutions, Inc.
- Federal Government contractor
- Founding NOVAJUG member
4and why am I here?
Global Schema
State/Local Agencys Systems
Overlapping Systems
Our XML Schema
Legacy Database
Draft Cases
Import/Export(XML, CSV, PDF)
5Presentation Outline
- XForms Defined
- What are XForms?
- Why should I care?
- Client-side examples/demo
- Server-side examples/demo
- Current status of XForms
6Poll the Juggies
- Have you used
- HTML
- XHTML
- XML
- XSLT/XSL/XPath
- XForms
Out with the old
In with the new!
7What is XForms?
- A new emerging W3C standard
- The successor of HTML forms
- Will replace them in XHTML 2.0
- Addresses limitations of HTML forms
- Adds common functionality found in most
form-applications
8Why XForms?
- Web forms are weak
- Diversity of frameworks used to overcome their
weaknessesbut they are proprietary and/or
commercial - Server infrastructures have established industry
standards for nearly all requirements - except
form-processing.
9This Will Change Drastically!
- Forms will be portable from one server to
another, serve different clients, provide rich
validation and calculation, and allow complex
logic without a single line of scripting code. - Furthermore XForms is maintainable through clear
separation of logic, data and presentation which
allow a role-based development process.
10Working Group Requirements
- XForms should use XML, both for initial data and
submitted data. - The difference between a blank form and a
filled-out form should be minimal and able to be
represented as an XML document. - Forms should be easy to route to multiple users
and locations. - XForms should separate purpose, presentation, and
form data. Earlier, each section describing an
HTML form control had to define two things how
the control looked, and how it affected the form
data set. XForms should cleanly separate these
two aspects. - XForms should provide the 20 percent of
functionality needed to avoid 80 percent of all
forms scripting. - Popular features such as calculations and
validations should be included in the language. - XForms should be designed in such a way to
encourage those using HTML forms to switch over
by making sure that all the commonly used
features in HTML forms are still possible in
XForms. - Taken from http//xformsinstitute.com/essentials/T
aken
11Four Limitations of HTML Forms
- Dependency on scripting languages
- Difficulty in initializing form data
- Flat representation of data
- Assumption of a one-step submission process
12HTML Forms Limitation 1
- Dependency on scripting languages
- Marking controls as required
- Performing validations and calculations
- Displaying error messages
- Managing dynamic layout
- which results in complex documents
- Time-consuming
- Costly
13XForms Advantage 1
- Reduces the need for script
- Defines a framework for simple, XPath-based
calculations and validations - Provides better user feedback on the status of
the form, through dynamic features such as
repeating tables and optional sections, and
through a system of XForms Actionselements that
cause commonly needed actions such as setting
focus or changing a data value.
14HTML Forms Limitation 2
- Difficulty of initializing form data
- Many options not as easy as they should be
- Often memory or processor intensive in
large-scale applications
15XForms Advantage 2
- Form data provided from an initial XML file,
which can be external to the form definition. - Since XForms is also flexible enough to deal
directly with most XML data formats, piping
initial data into a form is typically a simple
matter of pointing a src attribute to an existing
XML data source.
16HTML Forms Limitation 3
- Encoding formats, urlencoded or multipart,
represent "flat" data, or simply name/value
pairs. - Many types of forms would benefit from a richer
data representation.
17XForms Advantage 3
- XML is a superior foundation for most business
documents. - Since XML support is a fundamental requirement,
XForms excels at helping users create those kinds
of documents.
18HTML Forms Limitation 4
- A fundamental design flaw in HTML forms a hidden
assumption of a one-step processfrom a client to
a serverwith processing finishing there.
19XForms Advantage 4
- XForms allows form data to be routed as needed.
- At each stop, the data may be loaded into a form
for editing all or parts of the document, and
resubmitted. - Repeat as necessary.
20Simple XHTML Form
- ltform action"http//www.novajug.com/cgi-bin/pizza
.pl" namepizza-poll"gt - ltpgtPoll Meat or Veggie?lt/pgt
-
- ltlabel for"radio1"gtMeatlt/labelgt
- ltinput type"radio" namelovers" id"radio1"
value"meat"/gtltbr/gt - ltlabel for"radio2"gtVeggielt/labelgt
- ltinput type"radio" name"lovers" id"radio2"
value"veggies"/gtltbr/gt - ltlabel for"radio3"gtOther (please
specify)lt/labelgt - ltinput type"radio" name"lovers id"radio3"
value"other"/gtltbr/gt - ltinput type"text" name"othersel"/gt
- lt/formgt
21Simple XForms Form("lazy author" style)
- ltselect1 ref"mainsel" appearance"radio"
selection"open"gt - ltlabelgtPoll Meat or Veggie?lt/labelgt
- ltitemgt
- ltlabelgtMeatlt/labelgt
- ltvaluegtmeatlt/valuegt
- lt/itemgt
- ltitemgt
- ltlabelgtVeggielt/labelgt
- ltvaluegtveggielt/valuegt
- lt/itemgt
- lt/select1gt
22Initial Impressions?
- "Other, please specify" is implicit, since XForms
supports the concept of "open selection" lists. - To be able to submit this XForm, a small bit of
markup is required in the head section of the
document. - XML model exists elsewhere.
23Example 1 Client Side XForms
- Namespaces, Styles
- Model, Submission
- Presentation (controls text)
- lt!-- Live Demo --gt
24XSmiles Browser
Results in
25The Model
- Two most important jobs
- Specify structure of XML data created by a form
- Sample XML document used here
- Can use src attribute to point to an external
file - Can identify a W3C schema file w/info about
constraints - Defines what happens when the form gets submitted
26The Model cont.
- Other observations
- Submission element can have many attributes
- In a production application, wed likely post the
document to a process that uses the data
27The Display Form
- XForms is HTML-like, but with one crucial
difference - XForms lets you specify where in the model
instance to plug in the entered value upon
submission of the form. - The xfinstance elements model and ref
attributes show where to put the data upon
submission
28The Display Form cont.
- CSS should look familiar
- One exception The pipe symbol
- Used instead of a colon to separate namespace
prefix from rest of name - Width property used because XForms input
elements have no width attribute
29Example 2 Server-Side XForms
- Required fields, form field validation
- Field-level error messages
- Context-sensitive help
- Tool-tips
- Sticky forms
- Multi-occurrence, multi-value
- Other, please specify (version 2.7)
- lt! Live Demo --gt
30Orbeon Presentation Server
31Server-side XForms
32In Summary XForms
- Next generation of HTML forms
- Richer and more flexible than HTML forms
- Will be the forms standard in XHTML 2.0
- Platform and device independent
- Separates data and logic from presentation
- Uses XML to define form data
- Stores and transports data in XML documents
- Contains features like calculations and
validations of forms - Reduces or eliminates the need for scripting
- A W3C Recommendation
33Resources
- XForms 1.0 W3C Recommendation http//www.w3.org/T
R/xforms/ - Dubinkos O'Reilly XForms Essentials
http//xformsinstitute.com/essentials/ - XForms Data Typeshttp//www.w3schools.com/xforms/
xforms_typeref.asp - Ten Favorite XForms Engineshttp//www.xml.com/pub
/a/2003/09/10/xforms.html - Mozilla XForms Projecthttp//www.mozilla.org/proj
ects/xforms/ - XSmiles Browserhttp//www.xsmiles.org
- Orbeon Presentation Serverhttp//www.orbeon.com/s
oftware/
34Finally
- Slides available for download
- http//www.platinumsolutions.com/resources
- We are hiring! Please contact
- http//www.platinumsolutions.com/careers/
- hr_at_platinumsolutions.com