Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 1 min read

Support

Motivation

Here is an example web service provided by Amazon. It also uses the custom control to bind images from the output to the screen.

Load Form

Sample Program

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Searching Amazon</title>
<xf:model id="mQuery">

<xf:instance id="iQuery">
<instanceData xmlns="">
<t>webservices-20</t>

<dev-t>D1723OX2631XW0</dev-t>
<KeywordSearch>xforms</KeywordSearch>
<mode>books</mode>
<type>lite</type>
<page>1</page>
<f>xml</f>
</instanceData>
</xf:instance>

<xf:instance id="iResults">
<instanceData xmlns=""/>
</xf:instance>

<xf:bind id="bndResults" nodeset="instance('iResults')/Details"/>

<xf:submission
id="subAmazonQuery"
action="http://xml.amazon.com/onca/xml3"
method="get"
separator="&"
ref="instance('iQuery')"
replace="instance"
instance="iResults"
omit-xml-declaration="yes"/>

<xf:submission
id="subTestAmazonQuery"
action="http://xml.amazon.com/onca/xml3"
method="get"
separator="&"
ref="instance('iQuery')"
replace="all"/>
</xf:model>

<bindings id="xformsBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="output-image"
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<html:div>
<html:img anonid="content" style="margin-right: 5px;"/>
</html:div>
</content>
<implementation implements="nsIXFormsUIWidget">
<method name="refresh">
<body>
var img = document.getAnonymousElementByAttribute(this, "anonid", "content");
img.setAttribute("src", this.stringValue);
return true;
</body>
</method>
</implementation>
</binding>
</bindings>
<style type="text/css">
@namespace xf url(http://www.w3.org/2002/xforms);
body {
font-family: Helvetica, sans-serif;
}
-- Bind the custom control to output with class="image" -->
xf|output.image {
-moz-binding: url('#output-image');
}
</style>
</head>
<body>
<h1>Search Amazon With XForms Web Service</h1>
<xf:input ref="KeywordSearch">
<xf:label>Search string: </xf:label>
</xf:input>
<hr/>
<xf:submit submission="subAmazonQuery">
<xf:label>Search Amazon</xf:label>
</xf:submit>
<xf:submit submission="subTestAmazonQuery">
<xf:label>Show results as XML</xf:label>
</xf:submit>
<xf:repeat bind="bndResults">
<xf:output class="image" value="ImageUrlSmall"/>
<xf:trigger appearance="minimal" style="cursor: hand;">
<xf:output ref="ProductName"><xf:label>Title: </xf:label></xf:output>
<br/>
<xf:output ref="Authors/Author"><xf:label>Author: </xf:label></xf:output>
<xf:load ev:event="DOMActivate" ref="@url" show="new"/>
</xf:trigger>
<br/>
<hr/>
</xf:repeat>
</body>
</html>

Discussion

Note: If you get the following error:

XML Parsing Error: not well-formed
Line Number 33, Column 23:
separator="&"

You will have to remember to escape the ampersand before after you copy and paste this example into your text editor. You can get around this by doing a copy from the edit panel or just putting the following into the separator field:

separator="&"

References

This program was based on an example provided by formsPlayer
[1].

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
- Uncompress the zip file on your local file system - Change any occurrences of **"&"** to **& a m p ;** and remove **& n b s p ;** and **& c o p y ;** in the HTML files to make the files well formed XHTML files so that eXist can index them. The following files in the 3.2 release will need to be mod
CC BY-SA 4.0
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.
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