Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

Motivation

You want to dynamically modify your tabs while the form is executing.

Method

Rather than statically loading all your tabs in the form body it is also possible to store your tabs in the XForms model and then display each of them by using a repeat.

Full Example

declare namespace h = "http://www.w3.org/1999/xhtml";

let $content-type := "text/xml"
let mode := xdmp:set-response-content-type(content-type)
let $results :=
(
processing-instruction {'xml-stylesheet'} {'type="text/xsl" href="/lib/xsltforms/xsltforms.xsl"'},
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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

Tabs
id="data-model">
id="tabset-instance" xmlns="">
value="create">
value="create">Create
value="configure">Configure
value="validate">Validate
value="review">Review

type="text/css">
body {margin:0.25in;}

.xforms-repeat-item {
display:inline-block;
font-size:12pt;
font-family:Arial;
text-align:center;
padding:5px;
border:solid 1px black;
background-color:lightGray;
-moz-border-radius-topleft:10px;
-webkit-border-top-left-radius:10px;
-moz-border-radius-topright:10px;
-webkit-border-top-right-radius:10px;
}

/* this formats the selected tab differently so that you can tell what tab you are using */
.xforms-repeat-item-selected {
border-bottom:solid 3px white;
background-color:white;
}
.tabframe {
position:relative;
}

.tabs {
/* position:absolute;
z-index:2; */
margin-left:15px;
}

.tabpane {
width:800px;
height:500px;
border:solid 1px black;
z-index:1;
/* position:absolute; */
margin-top:-2px;
padding:10px;
box-shadow: 7px 7px 8px #818181;
-webkit-box-shadow: 7px 7px 8px #818181;
-moz-box-shadow: 7px 7px 8px #818181;
-moz-border-radius:10px;
-webkit-border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
};
]]>

class="tabframe">
class="tabs">
nodeset="instance('tabset-instance')/item"
id="tab-item-repeat">
ref="." appearance="minimal">
ref="."/>
ev:event="DOMActivate">
ref="instance('tabset-instance')/@value"
value="instance('tabset-instance')/item[index('tab-item-repeat')]"/>
ref=".">
value="@value"/>

class="tabpane">

id="create" selected="true">
Create Transformation Strategy
This is the pane where strategies for transformations are designed

id="configure">
Configure Strategy Parameters
This sets the parameters necessary for the execution of the strategy.

id="validate">
Validate Strategy Rules
This sets up tests for determining whether the transformation has succeeded or failed.

id="review">
Review Strategy
This provides a comprehensive review of the states defined within a given strategy.

)
return $results

Acknowledgments

This example was posted by Kurt Cagle on XML Today.

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, Folding Menus
CC BY-SA 4.0
XForms, Tree Menus
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