Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 1 min read

Support

Motivation

You want to have a region of your page that changes images when the user selects a button.

Method

Store a list of links to the slide images in an instance. Use another instance variable to store the state of the images is currently selected. Use a trigger to update the image number.

Load XForms Application

Sample Source Code

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

Slide Show
id="data-model">
id="data" xmlns="">

href="http://www.bav-astro.de/sterne/monv838/monv838-hubble-20040304.jpg">Image 1
href="http://aether.lbl.gov/Images/resizenowmap.jpg">Image 2
href="http://www.nasa.gov/images/content/143744main_hubble_spiral_2006.jpg">Image 3
href="http://www.space.gc.ca/asc/img/sci_core-hubble.jpg">Image 4

nodeset="instance('data')/link/@href" type="xs:anyURI"/>
id="state" xmlns="">

0

ev:event="cycle-next">
ref="instance('state')/cycle" value="(. + 1) mod 4"/>
name="update-model" target="data-model"/>

ev:event="update-model">

Next
ev:event="DOMActivate">
name="cycle-next" target="data-model"/>

ref="instance('state')/cycle"/>) ref="instance('data')/link[1 + instance('state')/cycle]"/>

ref="instance('data')/link[1 + instance('state')/cycle]/@href" mediatype="image/*"/>

Discussion

This program has the Next trigger calls the "cycle-next" named event when it is pressed. This event, which is defined in the model, updates the cycle and resets it back to one after the slides are done. After that it instructs the form to recalculate its dependency graph. This updates the visible image.

Note that the output must have a the mediatype set to be image/* for the browser to render the link as an image correctly.

Attribution

This example was created by Chris Wallace and the University of Western England.

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
The way to visualize this is to imagine a set divided into two distinct subsets: selected and un-selected items. As an item moves from the un-selected item set to the selected item set it must first be added to the new set and then deleted from the old set. ## Method This example uses a combination
CC BY-SA 4.0
XForms, Deep Copy with Insert Origin
CC BY-SA 4.0
The real power, and simplicity, of the form is in the value attribute of the xforms-setvalue element which itself is placed inside an xforms-trigger: value="concat(//text,'whatever you desire goes here')" ## Sample Program <html xmlns=" xmlns:xf=" xmlns:ev=" <head> <title>Insert BB code</title> <sty
CC BY-SA 4.0
This way if the user want to only make a simple change to the form only the logic for a single tab needs to be loaded. ## Example We will use a series of triggers that are styled as file tabs. Each trigger will perform two actions: it will run a save submission and it will then load the next part of
CC BY-SA 4.0
The user can check any number of items on the left list and press the Move Right button to move these items to the right list. The user can also add any number of items on the right list and then by pushing the Move Left button, these items would be moved to the left list. Note that a "move" is tech
CC BY-SA 4.0
XForms, Queue Management