Default trigger

From W3C XForms Group Wiki (Public)
Jump to: navigation, search

Requirement : We need a direct, declarative way to indicate that a particular control is the control to activate if a "hyperactivation" occurs within a group of controls.

The working group considering this issue at length. Here is what a defaulting method might look like today:

<group ref="some/node">

  <dispatch ev:event="DOMActivate" event="DOMActivate" target="default"/>
  <input ref="value1"> ... </input>
  <input ref="value2"> ... </input>
  <input ref="value3"> ... </input>
  <submit id="default" submission="X"> ...</submit>

</group>

If you enter data into any of the input controls, they only get a value changed event. But if you "activate" the input (for example, by typing a value and hitting enter in the usual desktop user agent), then the DOMActivate will bubble up to the group level. The dispatch will then capture it and trigger the default submission.

Aside from being an unwieldy authoring experience, this method has several unfortunate flaws.

First, the method does not generalize to all types of controls. In particular, select and select1 controls are activated by virtue of making a selection. This is not what the user expects. There is a difference between activating the select/select1 by making a selection versus making a "hyperactivate" (for example, by hitting enter on a typical desktop UA while the control has the focus).

Second, the method above flatly does not work because it gets into infinite loop. The dispatch activates the control by dispatching DOMActivate to the control, but the event bubbles back up to the group, which causes the dispatch to fire again, for ever and ever