Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

Motivation

You want to have a menu that allows you to navigate a tree hierarchy of editable items.

Source Code

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

Hierarchial Tree Menu
href="tree.css" type="text/css" rel="stylesheet"/>
id="modelOI">
xmlns="" id="instanceData">

code="">
code=""/>
code=""/>

code="">
code=""/>
code=""/>
code=""/>

code="">
code=""/>
code=""/>

nodeset="Lot/@code" calculate="position()"/>
nodeset="Lot/Item/@code" calculate="position()"/>
xmlns="" id="instanceTemplate">

code="">
code=""/>

id="divMenu">
ref="/Data/currentLot">
current Lot :

ref="/Data/currentItem">
current Item :

nodeset="/Data/Lot" id="repeatLot">

href="#" id="aLot">
ref="@code">
lot

ev:event="DOMActivate" ev:observer="aLot">
ref="/Data/currentLot" value="/Data/Lot[index('repeatLot')]/@code"/>
ref="/Data/currentItem" value="'?'"/>
case="editCode"/>

nodeset="Item" id="repeatItem">

href="#" id="aItem">
ref="@code">
item

ref="."/>

ev:event="DOMActivate" ev:observer="aItem">
ref="/Data/currentLot" value="/Data/Lot[index('repeatLot')]/@code"/>
ref="/Data/currentItem" value="/Data/Lot[@code=/Data/currentLot]/ Item[position()=index('repeatItem')]/@code"/>
case="editItem"/>

Insert Lot at last
ev:event="DOMActivate">

nodeset="Lot" at="last()" position="after" origin="instance('instanceTemplate')/Lot"/>
ref="/Data/currentLot" value="count(/Data/Lot)"/>
ref="/Data/currentItem" value="/Data/ Lot[count(/Data/Lot)-1]/Item[last()]/@code + 1"/>

Insert Item at selected Lot
ev:event="DOMActivate">

nodeset="/Data/Lot[index('repeatLot')]/Item" at="index('repeatItem')" position="after" origin="instance('instanceTemplate')/Lot/Item"/>

class="divEdition">

id="editCode">
ref="/Data/Lot[@code=/Data/currentLot]">

Lot n° value="@code"/>

ref="@code">
code :

id="editItem">
ref="/Data/Lot[@code=/Data/currentLot]/Item[@code=/Data/currentItem]">

Item n° value="@code"/>

ref="@code">
item :

CSS

#divMenu {
float: left;
width:220px;
margin: 0 20px 0 10px;
}

#divMenu ul {
padding: 0 0 5px 5px;
}

#divMenu li{
color:#000000;
}

#divMenu li .xf-repeat-item {
}

#divMenu .xf-repeat-index {
font-weight: bold;

}

#divEdition {
float: left;
}

Acknowledgments

This example was contributed to the Mozilla XForms Newsgroup by Andy Bailey on Apr 24 2008.

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
XForms, Deselect Events
CC BY-SA 4.0
The triggers refer to the instance. If a tab in the instance has a selected attribute set to "true" the corresponding trigger is "enabled" the other triggers are disabled (and by default not visible). They are made visible in the CSS statement for the disabled triggers. Two additional lines are need
CC BY-SA 4.0
<bookmarks> <section name="Book Homepage"> <bookmark href=" name="XForms Tutorial and Cookbook"></bookmark> </section> <section name="Introduction"> <bookmark href=" name="Background"></bookmark> <bookmark href=" name="Benefits"></bookmark> <bookmark href=" name="Installing and Testing"></bookmark>
CC BY-SA 4.0
Note that in the model there are a series of actions, each with their own event name: model id="data_model"> ... ev:event="addItemEvent"> ... These events are called directly inside of a trigger like this: name="addItemEvent" target="data_model" /> Note that the target attribute is the name of the m
CC BY-SA 4.0
XForms also allows a user to read data into a form using a HTTP **get** and to write data from a file using HTTP **put** operations using a remote web server. Just make sure you enable put operations on your web server and that the file you are putting is writeable This means you will need to do a c
CC BY-SA 4.0
This example will show you how to save intermediate form data to a local disk. Sometimes long forms take a while to fill out. You would like to allow users to fill out part of a form, log off, and resume their form when they return. Sometimes this intermediate data can be used as a default template