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

  • c0ff75
    started a topic TextItem with mask validation

    TextItem with mask validation

    Hello, all!

    I need to create TextItem with mask and with validation of value according this mask. Documentation say that for mask input I can use method setMask().

    It is logical to think that TextItem with filled setMask() should validate value according this mask. But it just "input mask" and user can fill value only partly and TextItem don't show error in this case.

    Certainly I can use validators for it (MaskValidator, RegExpValidator) and method setValidators(). But syntax of TextItem.setMask() and of these validators are diffrerent: for setMask() SmartGWT uses own syntax, for validators - standard RegExp.

    This means that I have to work twice: write the format of the input mask and separately write a regular expression to value validation.

    My question is: is it exists more easy way to use "input mask" and strictly validate values according it ?

    Best regards,

  • Isomorphic
    Validators are specified in DataSource files, since they affect many pathways (including, for example, REST requests to the RESTHandler servlet). Since a RegExp cannot be mechanically converted to an input mask, the way to do this would be to add a new MaskValidator which validated values against a mask, and which UI controls detect in order to default to masked input.

    This feature might add a tiny amount of code economy for a small number of users, where input masking happens to overlap perfectly with validation needs. It doesn't really have the bang for the buck to go on the roadmap, but we do have a Feature Sponsorship program if it has unusually high value for you.

    Leave a comment: