Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

Motivation

Users frequently want to select a date rather than have to type the date into a field. They often want to select a date such as "next Tuesday", but they might have to use a calendar to look up the day that Tuesday falls on.

Luckily a calendar selector is built in to most XForms implementations.

Screen Image

If you have a field that is "bound" to a date type the form will appear as follows:

Date Selector

Sample Program

Here is an example that uses the date picker:

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:xs="http://www.w3.org/2001/XMLSchema">

Example using a date selector by binding an instance to an XML Schema date type

xmlns="">

/>

nodeset="MyDate" type="xs:date" />

Example of using the date selector by binding an instance to an XML Schema date type:
/>
ref="MyDate">
Enter a date:

Testing

A small calendar icon should appear directly to the right of the input field. Click on the calendar icon and select a date. Note that you can change the day and the month using the calendar picker.

Discussion

The key line is:

nodeset="MyDate" type="xs:date" />

Note that if you do not use the bind command, the input will work like an ordinary text field.

The format that is put into the date field is YYYY-MM-DD which is the format used in XML for dates. You can use other formats such as MM-DD-YYYY but you will have to use an XPath expression to format the appearance of the field and make the appearance separate from the value in the model.

Once bound to type "xs:date", an empty string(date not set) will not allow the form to submit, there is no known direct solution, however using custom binding this can be overcome

example:

ref="Date" appearance="date" />

css:

@namespace xf url(http://www.w3.org/2002/xforms);
@namespace mozType url(http://www.mozilla.org/projects/xforms/2005/type);
xf|input[appearance="date"] {
-moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-date');
}
xf|input[appearance="date"] span[mozType|calendar] {
-moz-binding: url('chrome://xforms/content/widgets-xhtml.xml#calendar-full');
z-index: 2147481647;
}

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
type="text/css"> @namespace xf url(' .hidden .xf-value { display:none; } ]]> xmlns=""> 2006-09-12 nodeset="/MyModel/MyDate" type="xs:date" /> class="hidden" ref="/MyModel/MyDate" incremental="true"> Select Date: value="concat(substring(/MyModel/MyDate,6,2), '/', substring(/MyModel/MyDate,9,2), '/',
CC BY-SA 4.0
xmlns=" xmlns:xf=" xmlns:ev=" xmlns:xs=" xmlns:xsi=" > xmlns=""> xsi:type="xs:anyURI"/> ref="/Data/File"> file:///C:/tmp/*.xml text/xml ref="/Data/File"> File: ## Discussion At the time of this writing, there is little documentation on how the upload control works. The screen shot above was taken fr
CC BY-SA 4.0
Using a trigger abstraction allows your XForms to be more portable. ## Sample Program xmlns=" xmlns:xf=" xmlns:ev=" > Button Example xmlns=""> Button If you press this you will get a hello world message. level="modal" ev:event="DOMActivate">Hello World! ## Discussion This example has both a label an
CC BY-SA 4.0
This example demonstrates how to control the button appearance using labels, hint text and images. To see the button images appear you will need to create a file called XForms-button.jpg in the folder that this program is executed from. This example requires an image to be used in the program. This
CC BY-SA 4.0
It allows the user to select a numeric value from a range of values without using the keyboard. This is ideal for instructors that use interactive learning environments such as a SmartBoard. The XForms range has four attributes: - **start** - the lower bound of the range - **end** - the upper bound
CC BY-SA 4.0
This must be the ID of one of the submission elements in your model. Here is and example: submission="get-additional-data"/> If you reference this submission you will need a corresponding submission in your model. id="get-additional-data" .../> ## Common Usage The most common usage of send is to per