Hub Nexus
Updated

AuthorNo author yetClaim it

See something to improve? Propose a change.

Support

In XForms · page 43 of 137

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" />

...

Load 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 these publicationsXForms

LanguagesEnglish

Licence: CC BY-SA 4.0 · Adapted from en.wikibooks.org

1

0

0

0

Spinner Logo

Comments

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