Lets the user enter a numeric (integer or floating point) value.
Usage
<numberbox id='id' width='width' numberFormat='numberFormat' float='float' label='label' invalidNumberMessage='invalidNumberMessage' />
Fields
Field | Description |
---|---|
id |
Identifies the control when it is referenced in data-binding queries, reports, and workflow scripts. |
width | |
numberFormat | A number format that specifies conversion between text and numbers when displaying and parsing the input in the control. |
float | A boolean value that specifies the data type of the number
property: if true , the data type of number is set to floating point, if false , to integer. The
default value is false .
|
Properties
Property | Type | Description |
---|---|---|
label (read-only) | string |
Specifies the text that will be displayed as the label of the control. |
number (submitted) | int or float | The property used to set the number displayed in the control, or access the number that the user entered. |
invalidNumberMessage (read-only) | string |
The validation message displayed when the user input does not parse with the format
specified in |
Traits
Trait | Description |
---|---|
declarations |
A collection of zero or more variable declarations (let elements) that can be referenced in solution-wide query expressions. |
validation |
A collection of zero or more validation rules (validator elements) that evaluate user input in the control at
runtime, and prevent the user from submitting the form if the |
Remarks
The value of the number
property is either what the user
has entered or what data-binding has bound in the numberbox
, or
NULL
. number
is NULL
either if the input
does not conform to the numberFormat
field, or if there is a decimal
separator character in the input even though float
is set to false.
In the numberFormat
field, you have to specify the
required decimal separator for floating points, and optionally set up the allowed number of
digits in a digit group, specify the digit group separator, or insert a custom prefix or
postfix for the number displayed in the control.
If the input in the control does not parse as a date with
the format specified in the numberFormat
field, the validation message
specified in the invalidNumberMessage
is displayed next to the control, and
included in the validation summary.
Figure 240. The default invalidNumberMessage
displaying when the user enters a
floating point number in a numberbox
reserved for integers
Sample
<form id='numbox' menuName='Numberbox Sample' platforms='web' xmlns='http://schemas.mobilengine.com/fls/v1'> <table id="results" recordset='{SELECT rs.team_name, rs.team_score, rs.team_multiplier FROM resultSheet rs}' record='result'> <header> <row> <cell> <textview text="Team Name"/> </cell> <cell> <textview text="Score"/> </cell> <cell> <textview text="Odds Multiplier"/> </cell> <cell> <textview text="Final Result"/> </cell> </row> </header> <row> <cell> <textview text='{result.team_name}'/> </cell> <cell> <numberbox id="score" numberFormat='{decimalSeparator: ".", maxFraction: 2}' float="false" number='{result.team_score}'/> </cell> <cell> <numberbox id="odds" numberFormat='{decimalSeparator: ".", maxFraction: 2}' float="true" number='{result.team_multiplier}'/> </cell> <cell> <numberbox numberFormat='{decimalSeparator: ".", maxFraction: 2}' float="true" number='{result.team_score * result.team_multiplier}'/> </cell> </row> </table> </form>
A workflow script running in the Mobilengine Cloud would access the submission of the webform above in the format below:
{... results: { rows: [ {score: {number: 25}, odds: {number: 0.2}}, {score: {number: 6}, odds: {number: 20.0}}, {score: {number: 60}, odds: {number: 0.6}} ] }, ...}
See the workflow script reference guide for more details on data type mapping.