Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 1 min read

Support

Motivation

You want to conditionally display different areas of the screen based on static IDs.

Screen Image

As you click on one of the three buttons on the top row, the view displayed below will change.

Switch and Case

Sample Program

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

Switch, case and toggle

type="text/css">

@namespace xf url("http://www.w3.org/2002/xforms");
xf|group {
border: solid black 2px;
background-color: silver;
height: 100px;
}
xf|group xf|label {
position: relative;
font-family: Helvetica, sans-serif;
font-weight: bold;
background-color: white;
padding: 2px;
top: -10px;
left: 10px;
}
xf|group p {
position: relative;
top: -30px;
padding: 5px;
}
]]>

/>

View One
case="case-1" ev:event="DOMActivate" />

View Two
case="case-2" ev:event="DOMActivate" />

View Three
case="case-3" ev:event="DOMActivate" />

/>
/>

id="case-1">

View One
One One One One One One One One One One One One One One One One One One

id="case-2">

View Two
Two Two Two Two Two Two Two Two Two Two Two Two Two Two Two Two Two

id="case-3">

View Three
Three Three Three Three Three Three Three Three Three Three Three Three Three Three Three Three Three

Discussion

XForms provides an easy ways to swap between views. This also shows how the XForms group and label can be used like the HTML fieldset and legend.

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
ref="/var/first" > Should I show the second question? /> select="yes"> Yes Please! 1 No Thank You 0 /> ref="/var/second"> Second value: ## Using Multiple Predicates in Binds Sometimes you have a sequence of many items and the display of one item depends on the values of other items. Predicates are a
CC BY-SA 4.0
Then we add a predicate to turn on or off that entire group. In this case if the code is "yes" the input field will be displayed. If it is not the field will be hidden. ref=".[code='yes']"> ref="field"> Conditional Display: ## Complete Example xmlns=" xmlns:xf=" Binds in Repeats type="text/css"> @na
CC BY-SA 4.0
When you are done setting the months the control is set back to the hidden mode. ![XForms Control Visible]( XForms Control Visible (Image: The original uploader was Dmccreary at English Wikibooks ., CC BY-SA 3.0) ## Sample Code xmlns=" xmlns:xf=" xmlns:ev=" Show/Hide Control type="text/css"> @namesp
CC BY-SA 4.0
John Fred Sue Here is an example of this rule: id="triggerDisplay" nodeset="display-delete" relevant="count(/data/person) > 1"/> The above uses the XPath count() function with the greater than operator. But since it must be escaped you must use the ">" instead of ">". Or alternatively the delete but
CC BY-SA 4.0
For example, suppose you had a set of fields related to shipping supplies to remote staff in your IT department. The billing address could not be changed, only who an item was shipped to. The following single line in the model would make all of the sub-elements of BillToAddress read-only: nodeset="/
CC BY-SA 4.0
XForms, Select and Group