15
Views
9
Comments
Solved
Remove special Character  using  Extended Properties onkeypresss
Question
Service Studio Version
11.8.1 (Build 23450)

Dear All,

Dear All, I have a problem when inputting the free text box where the user cannot input containing special characters.

I will limit the input using onkeypress's Extended Properties

Please provide a solution


Noted: I have used Regex_Search but because there are a lot of fields that have to be inputted, it is not possible to check when the Action submit data


Rank: #1360
Solution

Hi ,

You can use below script , i hope this will be helpful to you.

Please check by below URL and attached OML File:

https://rahuljain877.outsystemscloud.com/Example/AllowCharDigit?_ts=637406418343636673

function onlyCharNumber(e,Id)

   

   var element = document.getElementById(Id);

   var str=element.value;

   var startPos = element.selectionStart;

   debugger;

   var code = (e.which) ? e.which : e.keyCode

   

  if (!(code == 32) && // space

    !(code > 47 && code < 58) && // numeric (0-9)

    !(code > 64 && code < 91) && // upper alpha (A-Z)

    !(code > 96 && code < 123)) // lower alpha (a-z)

     { 

      e.preventDefault();

    }

Thanks

--RJ---

Example.oml

Dear Rahul Jain

i'm using traditional web.how to implement this?


Rank: #1360

Hi ,

I am sharing same OML file for traditional  web . so it will be easy to implement.

Regards 

--RJ--


Rank: #1360

Hi ,

I was create one example in traditional  web , please check by below url. 

 i hope this will be helpful to you.

https://rahuljain877.outsystemscloud.com/Traditional/WebScreen1.aspx?_ts=637406892940833325


Regards 

--RJ--



Test1.oml

Rank: #1360
Test1Updated.oml

Dear Rahul Jain,

Thanks for the extra support, I try to publish it at my place and work

my

onlyCharNumber('wt14_OutSystemsUIWeb_wt18_block_wtContent_wtMainContent_wtInput_TextVar')

For the code above, which I Bold, I just found out that there is a syntax in outsystems, if I may know what it does? does this apply to Service Studio Version Platform Outsystems?

Hi! 

you can use the onkeypress property "keyCode" in a function like : 

function handle(event){
if(event.keyCode === 45 || event.keyCode === 46) {event.preventDefault();}
    }

This example will prevent the user to use - (hyfen/minus) or .(FULL STOP)

The list of the codes can be seen here

Hope this helps

Graça

Rank: #1360
Solution

Hi ,

You can use below script , i hope this will be helpful to you.

Please check by below URL and attached OML File:

https://rahuljain877.outsystemscloud.com/Example/AllowCharDigit?_ts=637406418343636673

function onlyCharNumber(e,Id)

   

   var element = document.getElementById(Id);

   var str=element.value;

   var startPos = element.selectionStart;

   debugger;

   var code = (e.which) ? e.which : e.keyCode

   

  if (!(code == 32) && // space

    !(code > 47 && code < 58) && // numeric (0-9)

    !(code > 64 && code < 91) && // upper alpha (A-Z)

    !(code > 96 && code < 123)) // lower alpha (a-z)

     { 

      e.preventDefault();

    }

Thanks

--RJ---

Example.oml

Dear Rahul Jain

i'm using traditional web.how to implement this?


Rank: #1360

Hi ,

I am sharing same OML file for traditional  web . so it will be easy to implement.

Regards 

--RJ--


Rank: #1360

Hi ,

I was create one example in traditional  web , please check by below url. 

 i hope this will be helpful to you.

https://rahuljain877.outsystemscloud.com/Traditional/WebScreen1.aspx?_ts=637406892940833325


Regards 

--RJ--



Test1.oml

Rank: #1360
Test1Updated.oml

Dear Rahul Jain,

Thanks for the extra support, I try to publish it at my place and work

my

onlyCharNumber('wt14_OutSystemsUIWeb_wt18_block_wtContent_wtMainContent_wtInput_TextVar')

For the code above, which I Bold, I just found out that there is a syntax in outsystems, if I may know what it does? does this apply to Service Studio Version Platform Outsystems?

Rank: #171

Hi Hothorasman,


I replied to a question some time ago, that was exactly the same case as yours.

See here in this topic if it helps you!


Cheers and Regards,
RR :)