Restrict special characters in input field

want to allow only alphanumeric keys in input field. 

Solution

Hi Poonam,

One more solution:

1) Add the below JS script to the Input widget --> onkeyup extended property as shown below

onkeyup="this.value=this.value.replace(/[^a-zA-Z0-9]/g, '')"

Hope this helps you!


Regards,

Benjith Sam

Solution

Benjith Sam wrote:

Hi Poonam,

One more solution:

1) Add the below JS script to the Input widget --> onkeyup extended property as shown below

onkeyup="this.value=this.value.replace(/[^a-zA-Z0-9]/g, '')"

Hope this helps you!


Regards,

Benjith Sam

 working fine in traditional but how to do it in Reactive.

 

Hi Poonam,

The simplest and fastest (performance-wise) way is to use the regular expression. 

^[a-zA-Z0-9]*$ It matches any alphanumeric string (no spaces).

Description:

^ : start of string
[ : beginning of character group
a-z : any lowercase letter
A-Z : any uppercase letter
0-9 : any digit
] : end of character group
* : zero or more of the given characters
$ : end of string

Regards,

Swatantra