This shows you the differences between two versions of the page.
— |
en:template:numeric_input_field [2016/08/11 10:33] (current) Nicolas Ronvel created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Numeric Input fields ====== | ||
+ | **Numeric Input** fields are text areas in which a user can input a number value. This number value can then be used to interact with the canvas fields. Note that this type of input can sometimes behave differently [[http://caniuse.com/#feat=input-number|depending on your browser]]. | ||
+ | |||
+ | <code javascript> | ||
+ | "fields": [ | ||
+ | { "name": "myfieldname", "label":"My field", "default": 44, "type": "number" } | ||
+ | ] | ||
+ | </code> | ||
+ | |||
+ | The ''default'' property here is set to a numeric value (without quotes), and is important. If the user puts a non-numeric value in the input (depending of the browser, it can possible), the default value will be used. | ||
+ | |||
+ | ===== Using the variable ===== | ||
+ | |||
+ | With each **Numeric input** field created, a variable is created. To use it in the ''canvasFields'', have the value of a property set to the string ''&myfieldname''. It will be replaced by the value set in the field. Note that this value will a numeric one, and cannot be used for the ''text'' property, for instance. But it is totally valid for a ''fontSize'', ''width'', or ''fontWeight''. | ||
+ | |||
+ | You still can get a string value from this variable, using the [[Advanced String Variables]]. By using the string ''$myfieldname$'' in such a variable, you'll get the numeric value as a string. |