Etwas zu verbessern? Schlag eine Änderung vor.
Motivation
When a form loads you want to set the initial cursor position so the user's first keystrokes are entered into the first field. This prevents the user from having to select the first field on a form with the mouse. Although some people consider this "polish" it is the hallmark of a conscientious developer.
Method
To perform this task you must do two things. First you need to give the control you want to receive the first keystroke event an id attribute. For example:
id="first-field">
Search
The next step is to use the xforms-ready event to set the focus to this field using the setfocus element.
These initial actions are usually placed at the end of the model in the html header but before the body.
...
ev:event="xforms-ready">
control="first-field" />
...
Link to XForms Application
Source Code
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events" >
Initial Cursor Positioning
xmlns="">
ev:event="xforms-ready">
control="first-field" />
Initial Cursor Positioning
ref="element1" id="first-field">
Element One:
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.
In diesen PublikationenXForms
Lizenz: CC BY-SA 4.0 · Bearbeitet nach en.wikibooks.org
1
0
0
0

Kommentare






