The Numeric Input object is very similar to the Text Input one. The difference is that Numeric Input only allows numbers to be entered. Depending on the browser its appearance may differ.
The Numeric Input object corresponds to the <input type="number"> HTML tag.
To create a Numeric Input object, use the mouse to draw a rectangle where you want the field to appear. The Numeric Input properties can be accessed from the Properties Panel, allowing you to define the appearance and behaviour.
- id: use this property to set a unique name for your Numeric Input. It will allow you later to modify its properties programatically.
- initial-value: add here any number only if you want the Numeric Input to be prefilled with that content.
- max-length: put here a number to limit the maximun characters allowed on the Numeric Input.
- place-holder: this attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format). The short hint is displayed in the input field before the user enters a value.
- property-name: this is important if you want to send the data from a Form with a Numeric Input to a server. The server script will get the value associated to this property name. See Form object for more info.
- variable: if you want to store the Numeric Input data into a variable to keep track of its content, just add the variable name using brackets into the variable property (ie: [name]). For more information see Understanding Actions and Variables.
At runtime, the variable will contain whatever has been typed into the field. You can modify the contents of the Numeric Input object by manipulating the variable using a simple Action Command. For example:
SetVar "[age]" 34
Similarly, you can clear the contents of the Numeric Input object like this:
SetVar "[age]" ""