Home arrow XML arrow Page 3 - XForms Basics, Part 3

Money, Money, Money - XML

XMLIn the previous article, I showed you how to manage user input in the XForms model. I discussed the process of submitting an XForm and more importantly - validating user input prior to submission using built-in XML Schema support. In this concluding article, find out how to use the <xforms:bind> element to perform calculations on form input values, integrate XPath expressions into your XForms model and get a crash course in the XForms event model.

  1. XForms Basics, Part 3
  2. Operating with Extreme Caution
  3. Money, Money, Money
  4. Shop 'till You Drop
  5. The Bookworm Turns
  6. An Event to Remember
  7. Link Out
By: Harish Kamath, (c) Melonfire
Rating: starstarstarstarstar / 14
January 19, 2004

print this article



Of course, the "required" attribute is just one example of what XForms calls "model item properties." Another one is the "relevant" attribute, which specifies when a particular element of the instance data is enabled or disabled. Consider the following example:

<!-- form model -->
<xforms:model id="tran">
<type />
<amount />
<checkNumber />
<xforms:bind nodeset="/transaction/checkNumber"
="/transaction/type='check'" />

Basically, this says that when performing a transaction (in this case, a bank account transaction which is either a deposit or a withdrawal) the check number is only relevant when the transaction involves a check.

Of course, it's up to the implementation to decide how to handle this particular property. Some implementations might disable the field for data entry during cash transactions, others might hide it, and still others might pop up a warning.

You'll notice, also, that the "relevant" property contains an equality test. Model item properties can contain comparison tests, so long as these conform to the rules laid down for XPath expressions. Here's another example, this one illustrating the use of a comparison test with the previously-explained "required" property by requiring the entry of a tax identification number for transactions greater than $50,000:

<!-- form model -->
<xforms:model id="taxes">
<name />
<amount />
<taxID />
<xforms:bind id="taxIDRequired" nodeset="/transaction/taxID"
="/transaction/amount &gt; 50000" />

>>> More XML Articles          >>> More By Harish Kamath, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates


Dev Shed Tutorial Topics: