Introduction
This message will be shown when the form control cannot properly bind to
instance data or when the instance data value is invalid or out of the
specified range of selectable values (see the spec). The message of the alert element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text.
Attributes
- Single-Node Binding
- Linking
- src - URL of a document whose contents will be retrieved by the
alertelement and used to provide the alert message for the containing form control.
- src - URL of a document whose contents will be retrieved by the
Type restrictions
The alert element can be bound to any simple content.
Representations
Can be represented in two ways:
- modeless window that contains the
alertelement's message (default representation). - the
alertelement's message can also be displayed immediately after the containing form control element in the XForms document's layout. This representation is used if thealertelement has an inline display style.
Examples
<xforms:model>
<xforms:instance>
<data xmlns="">
<x>10</x>
</data>
</xforms:instance>
<xforms:bind id="x" nodeset="x" type="xsd:integer"/>
</xforms:model>
<style>
@namespace xforms url("http://www.w3.org/2002/xforms");
xforms|input:invalid xforms|alert.inline
{
display: inline;
font-style: italic;
width: 40%;
}
}
</style>
<xforms:input bind="x">
<xforms:label>You can type only numbers (validation happens on blur): </xforms:label>
<xforms:alert>Wrong value! You should type only numbers!</xforms:alert>
</xforms:input>
<xforms:input bind="x">
<xforms:label>You can type only numbers (validation happens on blur): </xforms:label>
<xforms:alert class="inline">Wrong value! You should type only numbers!</xforms:alert>
</xforms:input>