constraints - Constraints
Specifies number constraints.
Category
dataSyntax
<xe:this.constraints>
<xe:djNumberConstraints attributes>content</xe:djNumberConstraints>
</xe:this.constraints>
Usage
In Design mode, click All Properties and look for constraints under data.The
number constraints are properties of an object of type xe:djNumberConstraints as
follows:
| Property | Description |
|---|---|
| currency="code" | (Currency only) ISO 4217 currency code, for example, USD. |
| fractional="enable|disable|auto|true|false" | (Currency only) Whether to include the fractional part of the number. |
| loaded="true|false" | Whether the tag instance should be created when the page is loading. Defaults to true. |
| locale="Albanian|...|Vietnamese" | Overrides the locale used for formatting rules. Must be in the extraLocale list specified during dojo bootstrap. |
| max="n" | Maximum value that the user can enter. |
| min="n" | Minimum value that the user can enter. |
| pattern="pattern" | Overrides the localized convention. All users see the same behavior. Your application cannot be globalized. See Unicode Technical Standard 35. |
| places="n" | Number of digits following the decimal point. |
| strict="true|false" | Strict parsing. Defaults to false which is more tolerant regarding abbreviations, white space, and other user input. |
| symbol="s" | (Currency only) Overrides the localized symbol. Defaults to a lookup in the localized table of supported currencies. |
| type="decimal|scientific|percent|currency" | Format type. |
Examples
This example consists of a currency text box bound to a scoped variable, a button for submitting the page, and a computed field that displays the value of the scoped variable. Constraints are put on the user input.<xp:table>
<xp:tr>
<xp:td>Currency Text Box</xp:td>
<xp:td>
<xe:djCurrencyTextBox id="djCurrencyTextBox1" value="#{sessionScope.djCurrencyTextBox1}">
<xe:djNumberConstraints currency="USD" max="100"
min=".99" type="currency">
</xe:djNumberConstraints>
</xe:djCurrencyTextBox>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:button value="submit" id="button1">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true">
</xp:eventHandler></xp:button>
</xp:td>
<xp:td></xp:td>
</xp:tr>
<xp:tr>
<xp:td>Value</xp:td>
<xp:td><xp:text escape="true" id="computedField1" value="#{sessionScope.djCurrencyTextBox1}"></xp:text></xp:td>
</xp:tr>
</xp:table>