Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

XForms Checkbox Buttons

There is just a small difference between using xf:select1 for radio buttons and the xf:select for multiple selection check boxes. In this example instead of round circles there are squares and you can check multiple squares. Note that the output contains a string with spaces between the values. This is why screen labels can have spaces but values should only contain dashes between the values.

Note that in this program we use appearance="full" attribute.

XForms Application

Load XForms Application

Note that as you select multiple items a space-delimited list of items appears in the output. This is a good example of why you do not want to put any spaces in a selection item value tag.

Sample Program

xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
>

XForms Radio Button Using xf:Select appearance="full"

xmlns="">

type="xs:string"/>

XForms Radio Button Using Select appearance="full"

ref="MyCode" selection="closed" appearance="full" >

Red
red

Orange
orange

Yellow
yellow

Green
green

Blue
blue

Output: ref="/data/MyCode"/>

Using the Appearance Attribute

There are many ways to change the amount of screen area used to display a selection list with many items. The XForms specification suggests that the user can control this area using a simple attribute called appearance. The three suggested values
of appearance are:

appearance="full"
appearance="compact"
appearance="minimal"

Where:

"full": all choices should be rendered at all times.
"compact": a fixed number of choices should be rendered, with scrolling facilities as needed
"minimal": a minimum number of choices should be rendered, with a facility to temporarily render additional choices

Many systems simply use a CSS style sheet to change this layout.

W3C Specification on the User Interface Options for Selecting Many

Testing

You should see the output change as you check different boxes. If you check multiple boxes, the result is a string with spaces separating the checked values.

Note that the XForms "value" in lowercase, not the "label", is inserted into the output string. This is an excellent example of why values should not contain spaces, just lowercase letters and dashes.

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
Make sure to put the page into edit mode if you want to copy and paste the code. This is because Wiki software replaces the ampersand-lt-semicolon with a "&". xmlns=" xmlns:xf=" xmlns:xs=" xmlns:ev=" Select County type="text/css"> @namespace xf url(" body { font-family: Helvetica, sans-serif; font-s
CC BY-SA 4.0
XForms, Select1 Multi-Column
CC BY-SA 4.0
xmlns=" xmlns:xf=" Getting Selection List Data From the XForms Model type="text/css"> body {font-family: Helvetica, Verdanan, sans-serif;} ]]> id="my-item" xmlns=""> red id="code-tables" xmlns=""> ItemColorCode Red red Orange orange Yellow yellow Green green Blue blue Getting Selection List Data Fro
CC BY-SA 4.0
In this example the file that contains the codes is just a well-formed XML file in the same directory that the form is located in. ## Loading XML instance data from a local file or web service The following code fragment, usually in the HTML head, demonstrates how to read XML data from a local file
CC BY-SA 4.0
Click on the calendar icon and select a date. Note that you can change the day and the month using the calendar picker. ## Discussion The key line is: nodeset="MyDate" type="xs:date" /> Note that if you do not use the bind command, the input will work like an ordinary text field. The format that is
CC BY-SA 4.0
type="text/css"> @namespace xf url(' .hidden .xf-value { display:none; } ]]> xmlns=""> 2006-09-12 nodeset="/MyModel/MyDate" type="xs:date" /> class="hidden" ref="/MyModel/MyDate" incremental="true"> Select Date: value="concat(substring(/MyModel/MyDate,6,2), '/', substring(/MyModel/MyDate,9,2), '/',