Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TextItem with KeyPress handler.

    Hai,
    I am using SmartGwt Java. To format the price using keyPressFilter, Please suggest any regular expression. It will accept only 0-9 and single decimal only.
    Now I am using KeyPress handler. In this if it is empty (default) set this value "0.00", using TextItem.setEmptyDisplayValue("0.00"). So First time it will accept single decimal eventhough there is another decimal present("0.00").
    Give solution for this issue.
    Thanks in advance.
    Regards,
    Sathya.

    #2
    The KeyPressFilter will only filter the keystrokes allowed, not based on context. Setting the filter to "[0-9\.]" should limit the bad values the can be entered. Then you still need a validator to handle the multiple decimal point issue. If the field is of type float, there will be a validator automatically assigned.

    If you want to handle the filtering by keystroke you basically have to replicate the text masking capability but add float handling. This is not supported by the existing text masking. However, if your value should always be a fixed entry you could enable a mask of 999#.##. But you still have the potential of a bad value by having a space in the number (i.e. 12 3.23).

    Comment

    Working...
    X