dijit/form/NumberTextBox.__Constraints (version 1.10)

Summary

Specifies both the rules on valid/invalid values (minimum, maximum, number of required decimal places), and also formatting options for displaying the value when the field is not focused.

Note: This is not a real constructor, but just a description of the type of object that should be passed as a parameter to some method(s), and/or the return value from some method(s). In other words, the type exists only for documentation purposes, and you cannot call new NumberTextBox.__Constraints()

See the dijit/form/NumberTextBox.__Constraints reference documentation for more information.

Examples

Example 1

Minimum/maximum: To specify a field between 0 and 120:

{min:0,max:120}

To specify a field that must be an integer:

{fractional:false}

To specify a field where 0 to 3 decimal places are allowed on input:

{places:'0,3'}

Property Summary

  • fractionalIf false, show no decimal places, overriding places and pattern settings.
  • localeoverride the locale used to determine formatting rules
  • maxMaximum signed value.
  • minMinimum signed value.
  • patternoverride formatting pattern with this string.
  • placesfixed number of decimal places to show.
  • round5 rounds to nearest .5; 0 rounds to nearest whole (default). -1 means do not round.
  • strictstrict parsing, false by default.
  • typechoose a format type based on the locale from the following: decimal, scientific (not yet supported), percent, currency. decimal by default.

Properties

fractional
Defined by: dojo/number

If false, show no decimal places, overriding places and pattern settings.

locale
Defined by: dojo/number

override the locale used to determine formatting rules

max

Maximum signed value. Default is +Infinity

min

Minimum signed value. Default is -Infinity

pattern
Defined by: dojo/number

override formatting pattern with this string. Default value is based on locale. Overriding this property will defeat localization. Literal characters in patterns are not supported.

places
Defined by: dojo/number

fixed number of decimal places to show. This overrides any information in the provided pattern.

round
Defined by: dojo/number

5 rounds to nearest .5; 0 rounds to nearest whole (default). -1 means do not round.

strict
Defined by: dojo/number

strict parsing, false by default. Strict parsing requires input as produced by the format() method. Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators

type
Defined by: dojo/number

choose a format type based on the locale from the following: decimal, scientific (not yet supported), percent, currency. decimal by default.

Error in the documentation? Can’t find what you are looking for? Let us know!