onclick
) or by registration
mechanisms that are specific to the scripting language in use. In contrast, XForms
has predefined actions (such as message
, setvalue
or
delete
). XForms also specifies events beyond DOM Events. Most
importantly, it uses the standardized XML encoding of XML Events to associate events
with actions. XML Events defines how to encode event-related information in XML.
With XML Events and XForms' predefined actions, the processing of specific events
can be defined declaratively, reducing the need for scripting.repeat
, which contains a template of inner widgets that will be
instantiated for each portion of the block of data in the form's data that the
repeat
is connected with. Early versions of HTML do not support
repetitions natively. Interestingly enough, repetition functionality has been a part
of Webforms 2repeat
element.repeat
element.evaluate()
evaluates an XPath expression against a
DOM node.createNSResolver()
generates a namespace resolver
object for all namespace definitions that are in scope at a specific DOM
node.XForms | HTML5 | Details |
---|---|---|
input |
input |
At default the XForms input widget enables free-form data entry(cf. |
output |
output |
- |
label |
label |
- |
trigger |
input , button |
In HTML5: The type attribute on the input element has to be
set to |
submit |
input |
In HTML5: The type attribute has to be set to |
secret |
input |
In HTML5: The type attribute has to be set to |
textarea |
textarea |
- |
upload |
input |
In HTML5: The type attribute has to be set to |
range |
input |
This is the only widget that needs HTML5 beyond earlier HTML versions.
In HTML5: The type attribute has to be set to |
select1 (full) |
input |
In HTML5: The type attribute has to be set to select1
containing a list of options. In HTML5 there must be one
input element per option. |
select1 (compact) |
option |
In HTML5: The size attribute has to be set to a value greater than "1". A browser will display it as a listbox. |
select1 (minimal) |
option |
In HTML5: The size attribute has to be set to "1". A browser will display it as a drop down selection box. |
select (full) |
input |
In HTML5: The type attribute has to be set to select
containing a list of options. In HTML5 there must be one
input element per option. |
select (compact) |
option |
In HTML5: The size attribute has to be set to a value greater than "1". Additional the multiple attribute has to be set. |
select (minimal) |
option |
In HTML5: The size attribute has to be set "1". Additional the multiple attribute has to be set. |
label
element). These classes provide methods and
class members for the specified attributes of the corresponding XForms element. When
an object is instantiated, these members are initialized with the default values
according to the XForms specification.model
element in the document. The object has connections to
all objects of elements which are related to the model
node in the
document. This relations can be expressed in different ways. Child elements of
the model
element are related in a direct way (e.g.
instance
or bind
). Widget and action elements can
point to a model
element by usage of the model
element. Finally Widget and action elements can be
implicit related to the first model
element defined in the
document, if they have no model
element and to the HTML5 form
element which
is generated during the parsing process. instance
elements. XForms augments the XPath specification with its own functions. These
XForms specific functions are of course not provided by the Web browser's XPath
interface. Thus the xf.js processor has to handle them by itself and can not
pass it through. Therefore a central evaluation method provides a good place to
implement these additional XForms functions. The processor supports the
additional functions instance() and index(). The evaluation method is also a
well fitting place for another XPath related feature which is still not
implemented: the implicit data model. If a node in the data model is referenced,
which does not exist, it is created by the XForms processor according to the
specification. The XPath interface of Web browsers does not provide such
functionality. But the evaluate method of xfModel could easily provide this
feature. If a XPath evaluation does not return any value, the next step should
be to check on every part of that expression if a corresponding node exists. If
this is not the case, the corresponding node could be generated by using the DOM
interface.form
element is created in the
document. This form is an anchor to all HTML5 widgets which are created to
replace the XForms widget elements. Each xfModel object holds a reference to its
form
element.instance
elements which
carry the data model of a form. In the processor one xfInstance object is
generated for every instance
element. At the current state of the
implementation each xfInstance object holds a reference to the DOM node of the
instance
element to perform read and write operations on the
data model. The XForms specification requests to handle all data models as
independent documents. Thus operations should not take place in the main
document itself. This feature would also be possible in a Web browser based
XForms implementation, as browsers implement the createDocument() interface as
defined in DOM Level 3 specificationsubmit
element and represented to the user as HTML5 button. When the user clicks the
button, the event of that click is handled at the xfWidgetSubmit object which
calls the doSubmit() method of the connected xfSubmission object.bind
element. As XML
Schema is not supported by browsers (and not implemented in the processor
neither) xfBind allows type checking based on the HTML5 form check interface.
The bind
element with one of
these type values, the form
element.trigger
element. As the browser
does not know the semantics of the XForms widget elements they are replaced by
their HTML5 counterparts according to Mutation observer
label
element, or on the
widget element itself, e.g. as caption of a button.repeat
element to display all child elements
inside it multiple times. This functionality is given in the processor with the
xfRepeat and xfRepeatGroup classes. The xfRepeat class represents the repeat
element itself. repeat
element refers to a nodeset in a data model. For every
node in this set the elements inside the repeat
element will be
repeated. The xfRepeatGroup object is used to represent such a repeat. It
contains a copy of all elements which are defined inside the repeat
element of the superior xfRepeat object. Every xfRepeatGroup object also refers
to one node of the repeat element's nodeset. insert
,
setvalue
, delete
and message
and the
superior element action
to group the others. Each element is
represented by a xfAction class, e.g. xfActionMessage. Each object owns a class
member xml.js
model
elements in a document and
multiple instances inside a model
element. Nodes in the data model can
either be referenced directly with a XPath expression by using the appropriate attribute
(bind
elements in the data model. A data model can be submitted
as XML or as name-value pairs according to form submission in HTML. model
, instance
, bind
and
submission
. For the user interface, the elements label
,
input
, output
, trigger
, submit
and repeat
are supported. To show the capabilities of Web browsers towards
events, the xf.js processor implements the Action elements insert
,
setvalue
, delete
, message
and the element
action
itself to group multiple other Action elements. These elements
can react on events generated by the Web browser (implementation currently supports
bind
element, like XML Schema types in other processors.message
element node gets a
function perform() associated which displays the defined message to the user when
called.repeat
element. We use the following XForms code as
example:insertbutton and after a click on the
deletebutton:
XForms for HTML Authors. [last accessed 24. Mar 2013]. http://www.w3.org/MarkUp/Forms/2003/xforms-for-html-authors.html
XForms 1.1 W3C Recommendation 20 October 2009. [last accessed 24. Mar 2013]. http://www.w3.org/TR/xforms/#ui-input