Hi Team,

I have a Input block with input type as Text. I want to apply regex to filter out numeric numbers and Special characters on keypress  for Mobile Development.(eg., Name inputfield must take only Alphabets)

I have checked this and this and this non worked out/Not understanding.

Please someone help me out with steps, so that I can implement on my project.

Note : Mobile Development(Android & iOS)

Thanks in advance.

Hello Rajesh

Please check the forge component "Restrict Characters mobile". This seems to provide exactly what you need. 

https://www.outsystems.com/forge/component-overview/5014/restrict-characters-mobile


Rajesh Nadar wrote:

Hi Team,

I have a Input block with input type as Text. I want to apply regex to filter out numeric numbers and Special characters on keypress  for Mobile Development.(eg., Name inputfield must take only Alphabets)

I have checked this and this and this non worked out/Not understanding.

Please someone help me out with steps, so that I can implement on my project.

Note : Mobile Development(Android & iOS)

Thanks in advance.

Hi Rajesh Nadar,

Refer Viraj Kataria solution in this link https://www.outsystems.com/forums/discussion/43966/numeric-keyboard-that-allows-only-0-9/

you can use following javascript for only alphabets

document.getElementById($parameters.WidgetId).addEventListener("keyup", function(e){
    var patternNotOk = eval("/[^a-zA-Z]/g");
    var text = this.value.replace(patternNotOk, '');
    if (this.value != text){
        this.value = text;
    }
});


Regards.,

Ellakkiya

Hi Rajesh Nadar,

Screen onReady function load JavaScript:

var patternNotOk = eval("/[^a-zA-ZçÇãÃáÁàÀõÕóÓ]/g");
document.getElementById($parameters.WidgetId).addEventListener("keypress", function(e){
    var text = this.value.replace(patternNotOk, '');
    if (this.value != text){
        this.value = text;
    }
});

document.getElementById($parameters.WidgetId).addEventListener("keyup", function(e){
    var text = this.value.replace(patternNotOk, '');
    if (this.value != text){
        this.value = text;
    }
});

Hope this helps.
Thanks

Hi Amal Raj ,Viraj Kataria and Ellakkiya Selvadurai ,

The suggested code does work on the Web but does not work properly on Android, When you press digits on keyboard it duplicates entered text multiple times.