Understanding XForms: The Model

by Kurt Cagle

This is the second in a series of articles I'm writing about the ongoing XForms implementation in Mozilla Firefox, with the previous article being Why XForms Matters, Revisited. Then next article in the series is Understanding XForms: Components

When you talk to people who've heard about XForms, they like the idea in theory ... until they encounter an actual XForms example. There's a brief period of shock, a momentary glazing of eyes, then inevitable the utterance, "but it's so ... complicated!" Then they run off to the WHATWG Web Forms 2.0 project, and continue to spend man-years attempting to script what they could have had free.

It hasn't helped that some of the most prevalent examples have been things like calculators, especially since calculators can actually be implemented in far easier fashion with straight Javascript on an ordinary HTML form, with XForms being overkill for it. The other "canonical" example is a W2 Form - and to be perfectly honest, while this actually is a better use of the technology, it is far too complex to be very canonical.

What I wanted to look at in this particular article is a much simpler walk through to put together an XForm based application that illustrates that it really isn't that difficult to create an XForm - you just have to have an understanding of what exactly XForms really are.


68 Comments

Allan Beaufour
2006-03-27 03:43:07
Another great article. And you are so right about the calculator, I've wanted to get rid of it for a long time.
mawrya
2006-03-27 16:36:05
Keep the articles coming. It would be especially nice to see an article dealing with styling of the form UI components, such as changing the width of a input field, the size of a textbox, highlighting differences in the way current HTML forms are styled.


I agree about Web Forms 2.0 - although easier to step up too, they still doesn't cut the mustard the way XForms do.

njs
2006-03-28 11:46:02
This was interesting. A few typo's could be corrected. for example, the element is not valid xml.
So one benefit you show is that xforms can make requests for arbitrary xml data from files on the server. Does it have to request the whole file?
Another benefit you show is that xforms can send arbitrary xml data to the server. Simply. Fine, and you still need a method of handling updates to the xml source on the server. Correct?
Finally, the article mentions that it is about the xforms implementation in mozilla. OK, so can you show examples of working code, complete with a screenshot?
I would be interested in how you would implement the updates of the server-side data file(s) containing the xml resources that the xforms manipulates.


-njs

Lars
2006-03-30 13:40:49
Good, helpful article. I agree that it has been difficult to look at an example of an XForm and figure it out. Your explanation about their not being a form element helps.
Lars
Kurt Cagle
2006-03-31 08:21:56
The code samples I've written all work (I'm usually copying them directly from the working prototypes) but you DO need to have the XForms extension installed. I'll make this point again in the next article, coming up soon.
Raj
2006-03-31 10:50:20
Testing XForms
Craig
2006-03-31 17:30:34
Great to see some work being done on this topic. I have worked with powerbuilder that has a GUI that data can be save to.


XFORM is potentially great if you can have a secure form with data and validation attached.


For example send a form to a client. They enter the data, potentially off line, and then email it back to you complete with data with the form validating the input.


And finally standards for cross browsers?

ewqe
2006-04-01 14:29:47
ewqewqe
Chris
2006-04-03 05:10:49
"The code samples I've written all work"


Sure about that? My guess is that

"<sf:submit>"
should really be
"<xf:submit />"
in the first example...
Kurt Cagle
2006-04-03 09:12:28
Chris,


Oooh, good catch. That was the submit to San Francisco option ;-)


Pretty sure that was a typo introduced after I pasted it, as my source was correct in that regard, but I've been appropriately taken to task nonetheless.


-- Kurt

Jack
2006-04-15 00:27:33
invicta watches
Den
2006-04-15 17:08:58
mens watches
Hans
2006-04-16 18:34:11
plus size clothes
Paul
2006-04-17 16:38:08
tractor supply company
male
2006-06-30 14:50:31
male underwear
free
2006-06-30 18:47:17
free xxx stories
lower
2006-07-01 19:09:18
lower back tattoos
blonde
2006-07-02 00:14:55
blonde teen
Mark
2006-07-02 10:16:18
discount golf clubs
spears
2006-07-02 15:55:54
britney spears posing
Zen
2006-07-02 17:06:07
chocolate chip cookie recipe
ass
2006-07-02 18:30:47
ass like that
Bob
2006-07-03 10:44:01
full metal jacket
Zen
2006-07-03 18:05:56
fleece blankets
Larry
2006-07-04 04:39:46
chain link fence
Paul
2006-07-06 19:09:41
meat loaf
Mattew
2006-07-07 04:28:43
gerber knives
mattress
2006-07-10 17:50:37
memory foam mattress
huge
2006-07-10 23:33:30
huge clit
Isaac
2006-07-11 04:59:32
movie posters
anderson
2006-07-11 17:21:18
pam anderson sucking
lilkim
2006-07-14 12:18:58
lil kim exposed
George
2006-07-14 18:04:54
wall decor
John
2006-07-21 21:46:32
ethan allen furniture
hardcore
2006-07-22 02:11:51
lolitas videos hardcore
Bob
2006-07-22 05:55:08
celtic tattoos
Mark
2006-07-23 02:25:33
african masks
Richard
2006-07-23 22:15:18
golf impact indicator
Paul
2006-07-24 05:11:41
teak furniture
Otto
2006-08-02 04:30:57
coffee grinder
as
2006-08-23 13:44:30
asdfasdf
hentai
2006-09-08 02:51:47
free hentai movies
sucking
2006-09-18 14:37:57
tit sucking
#FIRSTNAME
2006-09-25 15:47:30
#TEXT
#FIRSTNAME
2006-09-25 21:08:02
#TEXT
nice
2006-09-27 17:43:24
nice asses
body
2006-09-27 18:50:26
full body massage
Alex Blewitt
2006-09-30 19:41:41
Your example isn't a valid XML document, unless you meant <xf:submit/> :-)
free
2006-10-09 11:50:11
free pornography
ukdschgvj qinbxu
2006-10-10 12:55:46
mycrzfpj opih tewhg mwgiks mywkari pzxmtrufj ngfyolxw http://www.dtyekvlbj.ybpqocsn.com