The currency field.

The currency field uses the JQuery Price Format plugin to render format the input as it's entered.

Properties

TitleCurrency Field
DescriptionProvides an automatically formatted and configurable input for entering currency amounts.
JSON Schema Type(s)string
Field Typecurrency
Base Field Typetext

Schema

PropertyTypeDefaultDescription
defaultanyThe default value to be assigned for this property. If the data for the field is empty or not provided, this default value will be plugged in for you. Specify a default value when you want to pre-populate the field's value ahead of time.
dependenciesarrayList of property dependencies.
descriptionstringDetailed description of the property.
disallowarrayList of disallowed values for the property.
enumarrayList of specific values for this property
formatstringData format of the property.
maxLengthnumberMaximum length of the property value.
minLengthnumberMinimal length of the property value.
patternstringRegular expression for the property value.
readonlybooleanIndicates that the field is read-only. A read-only field cannot have it's value changed. Read-only fields render in a grayed-out or disabled control. If the field is rendered using a view with the displayReadonly attribute set to false, the read-only field will not appear.
requiredbooleanIndicates whether the field's value is required. If set to true, the field must take on a valid value and cannnot be left empty or unassigned.
titlestringShort description of the property.
typestringstringData type of the property.

Options

PropertyTypeDefaultDescription
allowNegativebooleanDetermines if negative numbers are allowed.
allowOptionalEmptyAllows this non-required field to validate when the value is empty
autocompletestringAllows you to specify the autocomplete attribute for the underlying input control whether or not field should have autocomplete enabled.
centsLimitnumber2The limit of fractional digits.
centsSeparatortext.The separator between whole and fractional amounts.
clearPrefixbooleanDetermines if the prefix is cleared on blur.
clearSuffixbooleanDetermines if the suffix is cleared on blur.
dataobjectAllows you to specify a key/value map of data attributes that will be added as DOM attribuets for the underlying input control. The data attributes will be added as data-{name}='{value}'.
disabledbooleanField will be disabled if true.
disallowEmptySpacesbooleanWhether to disallow the entry of empty spaces in the text
disallowOnlyEmptySpacesbooleanWhether to disallow the entry of only empty spaces in the text
fieldClassstringSpecifies one or more CSS classes that should be applied to the dom element for this field once it is rendered. Supports a single value, comma-delimited values, space-delimited values or values passed in as an array.
focuscheckboxtrueIf true, the initial focus for the form will be set to the first child element (usually the first field in the form). If a field name or path is provided, then the specified child field will receive focus. For example, you might set focus to 'name' (selecting the 'name' field) or you might set it to 'client/name' which picks the 'name' field on the 'client' object.
formobjectOptions for rendering the FORM tag.
helperstringField help message.
helpersarrayAn array of field help messages. Each message will be displayed on it's own line.
helpersPositionstringbelowDefines the placement location of the helper text relative to the control (either 'above' or 'below')
hiddenbooleanField will be hidden if true.
hideInitValidationErrorbooleanHide initial validation errors if true.
idstringUnique field id. Auto-generated if not provided.
inputTypestringAllows for the override of the underlying HTML5 input type. If not specified, an assumed value is provided based on the kind of input control (i.e. 'text', 'date', 'email' and so forth)
insertPlusSignbooleanDetermines if a plus sign should be inserted for positive values.
labelstringField label.
limitnumberA limit of the length of the field.
maskStringstringExpression for the field mask. Field masking will be enabled if not empty.
namestringField Name.
optionLabelsarrayAn array of string labels for items in the enum array
placeholderstringField placeholder.
prefixtext$The prefix if any for the field.
readonlybooleanField will be readonly if true.
roundstringnoneDetermines if the field is rounded. (Rounding is done when getValue is called and is not reflected in the UI)
showMessagesbooleantrueDisplay validation messages if true.
sizenumber40Field size.
sortfunctionDefines an f(a,b) sort function for the array of enumerated values [{text, value}]. This is used to sort enum and optionLabels as well as results that come back from any data sources (for select and radio controls). By default the items are sorted alphabetically. Don't apply any sorting if false.
suffixtextThe suffix if any for the field.
thousandsSeparatorstring,The separator between thousands.
typestringcurrencyField type.
typeaheadProvides configuration for the $.typeahead plugin if it is available. For full configuration options, see: https://github.com/twitter/typeahead.js
unmaskbooleantrueIf true then the resulting value for this field will be unmasked. That is, the resulting value will be a float instead of a string (with the prefix, suffix, etc. removed).
validatebooleantrueField validation is required if true.
viewstringAllows for this field to be rendered with a different view (such as 'display' or 'create')

Requirements

The Editor field requires the JQuery Price Format to be loaded ahead of its use.

Be sure to load lib/jquery-price-format2/jquery.price_format.min.js before rendering your forms. You can download JQuery Price Format from jquerypriceformat.com.

JQuery Price Format overwrites the unmask method of the JQuery Masked Input plugin. If you want to use JQuery Masked Input you should load the price format plugin before you load the masked input plugin.

Example 1

Currency field with default settings.

Example 2

Currency field with euro formatting.

© 2019 Gitana Software, Inc.

Alpaca is sponsored by