ALARM - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki
<ALARM/> : Widget
The alarm widget can be embedded inside of any form field widget. It is used to display validation messages and for validating it's parent <FORM/> during the submit() phase.
The alarm is considered to be alarming when its alarm's value is true. Forms cannot be submitted if one or more of its fields are in an alarming state.
If multiple alarms are specified, they are executed in the order in which they are defined and execution stops when the first alarm in the alarming state is encountered. This becomes the active alarm and the <FORM/>'s alarm attribute is set to the id of the alarm and its alarming state set to true.
Name | Type | Default | Description | Req |
---|---|---|---|---|
type | string | generic | Alarm types include generic, validation and mandatory. There can only be one validation or mandatory alarm on any form field. Mandatory alarms are automatically created when a form field's mandatory attribute is set to true. Creating a mandatory alarm provides a way to override the default mandtory alarm text displayed when the field is left empty. Validation alarms are automatically created for form field's that allow specific types, like type="phone" on an <INPUT/> widget. Creating a validation alarm provides a way to override the default error text that is displayed when the field fails validation. |
|
alarm | string | n/a | An evaluation string which must evaluate to a boolean. The result is reflected in the alarm's alarming property | ✔ |
text | string | The text to display when in the alarming state |
Name | Values | Default | Description |
---|---|---|---|
value | The value, {this} or {this.value} property holds the alarm's parent form field value and can be used in the alarm string as shown in example #1 below. |
Name | Description |
---|---|
onalarm | A list of ; seperated action(s) to execute when the alarming state changes to true. |
Example #1 : multiple alarms within a <TYPEAHEAD/>
<TYPEAHEAD id="typeahead2">
<OPTION value="clear"/>
<OPTION value="yes"/>
<OPTION value="no"/>
<ALARM alarm="={this}=='yes'" text="You selected ** YES **"/>
<ALARM alarm="={this}=='no'" text="You selected ** NO **"/>
</TYPEAHEAD>