TextInput mask

Hello,

Is it possible to mask a textInput? For example, in a date field the user is writing the value and automatically is getting a mask.

I tried something like that:

var htmlInputText = CAF.model('#{activePageBean.clientIds['htmlInputText']}');
htmlInputText.setMask('99/99/9999');

Thanks!

The client-side model of the input text control does not currently provide support for a mask. However, there are certainly many 3rd party javascript libraries that can do something like that or you can probably accomplish it with your own custom javascript code in the keyup client-side event handler of the text input control.

For example, something like this as the keyup client-side event handler:


var v = this.value;
if (v.match(/^\d{2}$/) !== null) {
    this.value = v + '/';
} else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
    this.value = v + '/';
}

If there are areas that you or a customer would like to be improved in documentation or functionality, then you can make a proposal in brainstorm @ https://empower.softwareag.com/Products/FeatureRequestsInBrainstorm/default.asp for consideration in a future release.