Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 1 min read

Support

Motivation

You would like to use a library of XML Schema simple types with restrictions to validate your form.

Notice

Most type validation with the exception of the most simple types does not currently work under the FireFox extension.

Sample Program sample.xhtml

xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ftype="http://www.example.com/my-file-types">

Validate Postal Codes
type="text/css">
@namespace xf url("http://www.w3.org/2002/xforms");
xf|input {
display: table-row;
line-height: 2em;
}

xf|label {
display: table-cell;
text-align: right;
font-family: Arial, Helvetica, sans-serif;;
font-weight: bold;
padding-right: 5px;
width: 150px;
}

*:required {
background-color: yellow;
}

*:invalid {
background-color: pink;
}

schema="schema.xsd">
src="instance.xml" />
id="zip" required="true()" type="ftype:zipType" nodeset="ftype:zip" />
id="zip2" required="true()" type="ftype:zip2Type" nodeset="ftype:zip2" />

bind="zip" incremental="true">
Zip Code:
Validation is not correctly specified for this field
The 'Zip Code' failed to validate!

bind="zip2" incremental="true">
Zip Code 2:
Validation is correctly specified for this field

value="concat('The "', name(), '" failed to validate!')" />

Example XML Schema File schema.xsd

xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ftype="http://www.example.com/my-file-types"
targetNamespace="http://www.example.com/my-file-types"
elementFormDefault="qualified" attributeFormDefault="unqualified">
name="data">

Test XML Schema

name="zip" type="ftype:zipType"/>

name="zipType">
base="xs:string">

value="\d{5}"/>

name="zip2Type">
base="xs:string">

value="^\d{5}$"/>

Sample instance document instance.xml

xmlns="http://www.example.com/my-file-types">
12345
12345

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
This program demonstrates how XForms can validate a data set based on the facets within and XML Schema. ## Warnings Note: This program does not run under the FireFox 0.6 extension. The X-Smiles browser was used to demonstrate this program. ## Screen Image This screen image was taken from the [X-Smil
CC BY-SA 4.0
XForms, SVG
CC BY-SA 4.0
But unlike most JavaScript functions, it will not be loaded into the browser until it is needed. ## Sample Program Here is an example of using the load element within an XForms trigger: First you will need a small JavaScript function to test like the following: <script type="text/javascript"> var My
CC BY-SA 4.0
XForms, Pie Chart
CC BY-SA 4.0
For a simple Pie Chart these might include: cht=p &chd=t:10,20,30,40,20 &chl=Amount|Indicator|Code|Date|Text &chs=400x300 Where: ** - is the Chart API's base URL The ampersand (&) separates parameters. **cht=p** is a code for the chart's type. For example p=2D Pie Chart and p3-3D Pie Chart **chd=t:1
CC BY-SA 4.0
Sending a **submit** will alter the Venn Diagram REST parameters. ### Screen Image of User Interface ![XForms User Interface for Venn Diagram]( XForms User Interface for Venn Diagram (Image: The original uploader was Dmccreary at English Wikibooks ., CC BY-SA 3.0) ### Output of Call to Google Charts