Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

NOTE

These examples do not appear to work with the FireFox 3 XForms addition. Sliders are hidden with XSLTForms (r406).

Motivation

You want to use a range control or "slider" to set a numeric value in your form.

Selecting from a continuous range of values

The range is a control that is part of the XForms specification. It allows the user to select a numeric value from a range of values without using the keyboard. This is ideal for instructors that use interactive learning environments such as a SmartBoard.

The XForms range has four attributes:

  • start - the lower bound of the range
  • end - the upper bound of the range
  • step - the increment of output change
  • incremental - true if the form should send continuous values to the model or false otherwise. The default is false.

These attributes MUST be bound to an element that has a numeric datatype. To do this you must add the following bind statements to your model:

nodeset="/data/my-int" type="xs:integer"/>

nodeset="/data/my-decimal" type="xs:decimal"/>

User Interface

There are three range controls in this application. The value of the range is on the right side.

Basic Range

Ranges Using Binds

Sample User Interface

xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

XForms Submit Example
type="text/css">
body {
font-family: Helvetica, sans-serif;
}

xmlns="">

3.14159
6
66

nodeset="/data/data1" type="xs:decimal" />
nodeset="/data/data2" type="xs:decimal" />
nodeset="/data/data3" type="xs:decimal" />

ref="data1" start="1" end="5" step="1" incremental="true">
Data1:

ref="data1">
Value=

/>
ref="data2" start="1" end="10" step="1" incremental="true">
Data2:

ref="data2">
Value=

/>
ref="data3" start="1" end="100" step="5" incremental="true">
Data3:

ref="data3">
Value=

Testing

Select one of the three range controls with the mouse. Drag the value to the right or left. You should notice that the values at the right also are updated.

The first control just selects decimals from 1 to 5. The second uses the step to return only integers. The last has a range of 1 to 100 in increments of 5. Note that the value is 66 and you cannot set a value from 62 to 65.

Discussion

The upper and lower values of the range control can also be set directly in the model. XML Schema provides a minValue and a maxValue that can be used to adjust the range control limits.

W3C Specification

Here is the specification from the W3C web site:
W3C range specification

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.

Get each new page of

XForms

Following means one email when a page is added, nothing when a page changes.

Following means one email when a page is added, nothing when a page changes.

Comments

Spinner Logo

Next in XForms

CC BY-SA 4.0
This must be the ID of one of the submission elements in your model. Here is and example: submission="get-additional-data"/> If you reference this submission you will need a corresponding submission in your model. id="get-additional-data" .../> ## Common Usage The most common usage of send is to per
CC BY-SA 4.0
Show can have two values: **new** or **replace**. - **target** - the target action to be executed One is the URI of the resource to load and the other is the show attribute. The show attribute can have values of "replace" which will replace the current form with the new resource and "new" which will
CC BY-SA 4.0
On many HTML forms you fill out the form and press a button at the bottom of the form called "Save" or "Submit". You pressed the button and hoped your data would get saved. This is the same concept. But in this case the submit command can be triggered in many ways other that just a button being pres
CC BY-SA 4.0
action=" method="post" id="submit" includenamespaceprefixes=""/> action=" method="post" includenamespaceprefixes="#default"/> ## Sample Form xmlns=" xmlns:ev=" xmlns:xsd=" xmlns:xf=" xmlns:task=" task:dummy="dummy"> Test of XForms Submission Namespace Inclusion type="text/css"> @namespace xf url(" b
CC BY-SA 4.0
xmlns=" xmlns:ev=" xmlns:xhtml=" xmlns:xs=" xmlns:fr=" xmlns:xxforms=" xmlns:xf=" Save Test xmlns="" id="save-data"> form-id="unit-tests-save-test"> Dan McCreary xmlns="" id="save-results"> No Save Results Yet id="save-submission" ref="instance('save-data')" method="post" resource=" replace="instanc
CC BY-SA 4.0
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(