Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 1 min read

Support

WARNING THIS EXAMPLE IN DEVELOPMENT

You would like to be able to select all rows in a table using a single trigger.

You can put a list of items in a table and have a single column that has a checkbox in it. You can then use the index function to change the selected item.

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<head>
<title>Select all, Unselect all</title>
<style type="text/css">
table {width:300px}
td,td {text-align: center; width:25%}
</style>
<xf:model>
<xf:instance xmlns="">
<data>
<item id="1" selected="false">
<title>red</title>
</item>
<item id="2" selected="false">
<title>orange</title>
</item>
<item id="3" selected="false">
<title>yellow</title>
</item>
<item id="4" selected="false">
<title>blue</title>
</item>
</data>
</xf:instance>
<xf:bind nodeset="item/@selected" type="xs:boolean" />
</xf:model>
</head>
<body>
<table border="1">
<thead>
<tr>
<th>position()</th>
<th>index()</th>
<th>color</th>
<th>select</th>
</tr>
</thead>
</table>

<xf:repeat nodeset="item" id="repeat-id">
<table>
<tr>
<td>
<xf:output value="position()" />
</td>
<td>
<xf:output value="index('repeat-id')" />
</td>
<td>
<xf:output ref="title" />
</td>
<td>
<xf:input ref="@selected" />
</td>
</tr>
</table>
</xf:repeat>
<xf:trigger>
<xf:label>Select all list [n]</xf:label>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="item[1]/@selected" value="'true'" />
<xf:setvalue ref="item[2]/@selected" value="'true'" />
<xf:setvalue ref="item[3]/@selected" value="'true'" />
<xf:setvalue ref="item[4]/@selected" value="'true'" />
</xf:action>
</xf:trigger>
<xf:trigger>
<xf:label>Unselect all list [n]</xf:label>
<xf:action ev:event="DOMActivate">
<xf:setvalue ref="item[1]/@selected" value="'false'" />
<xf:setvalue ref="item[2]/@selected" value="'false'" />
<xf:setvalue ref="item[3]/@selected" value="'false'" />
<xf:setvalue ref="item[4]/@selected" value="'false'" />
</xf:action>
</xf:trigger>
<br />
<xf:trigger>
<xf:label>Select all repeat</xf:label>
<xf:action ev:event="DOMActivate">
<xf:repeat nodeset="item" id="repeat-id-2">
<xf:setvalue ref="@selected" value="'true'" />
</xf:repeat>
</xf:action>
</xf:trigger>
<xf:trigger>
<xf:label>Unselect repeat</xf:label>
<xf:action ev:event="DOMActivate">
<xf:repeat nodeset="item" id="repeat-id-3">
<xf:setvalue ref="@selected" value="'false'" />
</xf:repeat>
</xf:action>
</xf:trigger>
<ol>
<xf:repeat nodeset="item" id="repeat-id-4">
<li>
<xf:output ref="@selected" />
</li>
</xf:repeat>
</ol>
</body>
</html>

Discussion

Note that the setvalues inside the repeat blocks do not work. I have tried to use the current() function inside the repeat like this:

ref="current()/@selected" value="'false'" />

but with no luck.

If anyone knows how to get this working, please let us know. Thanks - Dan

Alternate Way

Note: does not work inside .
Here is the workaround for this.

id="count">

nodeset="instance('count')" type="xs:integer" />

Select all repeat
ev:event="DOMActivate">
ref="instance('count')" value="0" />
while="instance('count') < count(item)">
ref="instance('count')" value="instance('count') + 1" />
ref="item[number(instance('count'))]/@selected" value="'true'" />

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
id="default-instance"> xmlns=""> B-item 2001-05-03 A-item 2005-05-03 Z-item 2003-05-03 D-item 2002-05-03 id="stylesheet"> xmlns="" xmlns:xsl=" version="1.0"> match="/"> select="data/item"> type="string" select="name"/> match="*|@*|text()"> select="*|text()|@*"/> To perform the sort we will use the f
CC BY-SA 4.0
Xfolite is licensed under the LGPL license. ### PicoForms [PicoForms]( has an XForms implementation that runs on cell phones supporting MIDP 2.0 and CLDC 1.x. It also supports PDAs including Palm and Pocket PCs. PicoForms is also able to provide customers (and evaluators) with an online development
CC BY-SA 4.0
To do this do the following. From the Windows start menu click Start/Run. Enter "regedit" and press enter. Use the Registry browser to navigate to the HKEY_CLASSES_ROOT folder and then find the MIME/Daatabase/Content Type folder.
CC BY-SA 4.0
The [Apache web server]( is the most popular web server on the Internet. It provides high-performance web pages serving and is very secure. By default, the out-of-the box Apache server does not allow users to write files to a web server. This is done for security reasons.
CC BY-SA 4.0
Many of these problems could be avoided by automatically reverting to the prior version of a configuration file. ## Background With the XForms standard we are given the element and a small list of HTTP operators (GET, PUT, POST) to use and an action that can be any URL. If we want to allow users to
CC BY-SA 4.0
[eXist]( is a native XML database that has a full REST interface. This allows you to use eXist to save form data without writing any middleware glue. ## eXist REST interface eXist provides a full REST interface that is easy to call from an XForm. ## eXist WebDAV interface eXist also provides a full