Hub Nexus
Opdateret

ForfatterIngen forfatter endnuOvertag den

Ser du noget at forbedre? Foreslå en ændring.

Støtte

Motivation

You want to be able to perform various tasks at various part of the form execution.

Method

XForms is integrated with the W3C XML Event standard. This standard creates standard names for almost
all of the common events used in the lifecycle of a form. The W3C has attempted to standardize these events
and their event labels so that they can be used consistently across browsers from all vendors.

XML Event Types

The following is a listing of the XForms events. Some events are tied to individual forms controls such as input, select and textarea and some are tied to the model within the form.

EventCancelBubblesTarget
Initialization Events
xforms-model-constructNY
xforms-model-construct-doneNY
xforms-readyNY
xforms-model-destructNN
Processing Events
xforms-rebuildYY
xforms-recalculateYY
xforms-revalidateYY
xforms-refreshYY
Interaction Events
xforms-previousYN
xforms-nextYN
xforms-focusYN
xforms-helpYY
xforms-hintYY
xforms-resetYY
xforms-submitYY
DOMActivateYY
Notification Events
DOMFocusInNY
DOMFocusOutNY
xforms-value-changedNY
xforms-selectNY, or
xforms-deselectNY, or
xforms-scroll-firstNY
xforms-scroll-lastNY
xforms-insertNY
xforms-deleteNY
xforms-validNY
xforms-invalidNY
xforms-in-rangeNY
xforms-out-of-rangeNY
xforms-readonlyNY
xforms-readwriteNY
xforms-requiredNY
xforms-optionalNY
xforms-enabledNY
xforms-disabledNY
xforms-submit-doneNY
xforms-submit-errorNY
Error Notifications
xforms-binding-exceptionNY
xforms-link-exceptionNY
xforms-link-errorNY
xforms-compute-exceptionNY

Displaying Events in a Log File

One of the best ways to learn about how events get fired is to write them to a log instance and display the log at the
bottom of the form. You can do this logging while you are building and debugging your form.

Add the following instance to your model:

xmlns="" id="log">

log initialized

Whenever you want to see an event, just add an action that appends an event to the end of the log:

ev:event="xforms-deselect">
nodeset="instance('log')/event" at="last()" position="after" />
ref="instance('log')/event[last()]" value="'Tab One deselected'" />

Note that the message must be inside a pair of single quotes inside of double quotes.

At the end of the form you can display the data from the log instance by enclosing the output within a repeat.

id="event-log">
nodeset="instance('log')/event" class="log">
ref="." />

You can also style the event log with the following

#event-log {
color: DarkGray;
background-color: Lavender;
}

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

I disse publikationerXForms

SprogEnglish

Licens: CC BY-SA 4.0 · Bearbejdet efter en.wikibooks.org

1

0

0

0

Spinner Logo

Kommentarer

Spinner Logo
Version: 2CC0 1.0 — public domain
The runaway star that left the Tarantula Nebula
Version: 2CC0 1.0 — public domain
The Blackwell School, where segregation had no law behind it
Version: 2CC0 1.0 — public domain
The Eagle Nebula, seen in the infrared
Version: 2CC0 1.0 — public domain
The house where the Equal Rights Amendment was written
Version: 2CC0 1.0 — public domain
The Aleutians, the forgotten front of the Second World War
Version: 2CC0 1.0 — public domain
The Cosmic Cliffs are not cliffs