Chapter 7. Actions and Events

“While we are free to choose our actions, we are not free to choose the consequences of our actions.”

Stephen Covey

“We are not ready for any unforeseen event that may or may not occur.”

Dan Quayle

Scripting. It sounds good, at first. With a quick hack, it can cure every problem you throw at it. It’s seductive. The problem is, a couple of months later, when you need to fix a bug or add another feature, you can’t remember what the script was supposed to do, and you spend a week reverse engineering the whole system. And you’ll do it again a few months later. And again, and again. The major problem with script is that even though it’s easy to get started with, it’s expensive to maintain. If you don’t believe it, try debugging someone else’s script some time.

There are other problems with scripting as well. Scripts are usually biased towards a visual platform, which means that accessibility aids, or even just regular users with an eyes-free browser, will tend to have trouble with scripting. For the foreseeable future, security-conscious users will have scripting disabled in their browsers.

The answer is to identify areas where scripting is most commonly needed, and create declarative replacements, which is exactly what XForms accomplishes. The core technology that makes this possible is called XML Events.

XML Events

An event, as far as XForms is concerned, is a data structure that gets passed around to certain interfaces, called event listeners. The Document ...

Get XForms Essentials now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.