behavior: currency

Currency input behavior.

Elements

that have this behavior applied by default (see master style sheet):

  • <input type=“currency” /> - inline single line
  • <widget type=“currency”></widget>

Attributes

that this behavior knows about:

  • value=float - initial value of the input element
  • size=integer - determines value of (intrinsic and default) width of the element.
  • format - format of number representation, string that accepts following ';'-separated fields:
    • grouping - number, number of digits in “thousand” groups.
    • fdigits - number, fractional digits to show.
    • leading-zero - true/false, show leading zero.
    • decimal-sep - string, separator between integer and fractional parts.
    • grouping-sep - string, separator between groups.
    • negative-sign - true/false, true - show '-', false - wrap digits by '(' ')' characters.
    • currency - string, currency sign to show.
    • currency-after - true - currency sign after , false - sign is before numbers.

If the format attribute is ommited then the behavior will use current user settings for currency.

Automatic attributes - set by behavior and can be used for styling purposes:

  • invalid - behavior will set this attribute if user provide wrong content (e.g. alpha characters)
  • negative - behavior will set this attribute if number is negative.
format attribute can also be defined in CSS as a custom attribute -format. Thus you may define it for group of input elements as:

input.decimal {
  behavior:decimal;
  -format="fdigits:2; leading-zero:true;"
}

Events

Together with the standard set of events (mouse, keyboard, focus) behavior: button generates:

  • EDIT_VALUE_CHANGED event - value of the element was changed due to user actions. Posted (asynchronous) event.
  • EDIT_VALUE_CHANGING event - sent when value of the element is about to change. Synchronous event.

Value

type json::value::V_FLOAT, reflects current status of internal editing buffer.

Special key combinations

See edit

h-smile/built-in-behaviors/currency.txt · Last modified: 2008/01/07 19:00 by andrew
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0