223
Views
9
Comments
 Restrict typing special character like @ % etc. in input

Can anyone help me what can I do to 

in name fields like this should not be allowed


I know regex replace is one way to do it but I can't make it work. Anyone can teach me how to do it? Most forums are outdated.


I tried inputmask but my problem is it does not allow space.

2023-06-15 06-47-16
Monica Anne Laurente

Hello Rahul, but I want to implement this without using any forge. Thanks

UserImage.jpg
Shriyash Dixit

Hey @Monica Anne Laurente
 
please refer below screenshot, you can achieve using OnKeyPressEvent of Input field. 
you have to send Input widget ID in JS code.

 


Thanks,

Shriyash Dixit

2023-06-15 06-47-16
Monica Anne Laurente

what does the js code do? I don't understand how it works

UserImage.jpg
Shriyash Dixit

It will restrict you from entering special characters


UserImage.jpg
Shriyash Dixit
2023-10-21 19-42-11
Tousif Khan
Champion

Hello @Monica Anne Laurente 

Check if this works for you, You need to add JS lib to your script folder and the use the function on your on ready action of Js

I am attaching sample
https://personal-ejuytnht.outsystemscloud.com/SA/SAmple?_ts=638203678533170967

Thanks
Tousif Khan

Sample.oml
2023-06-15 06-47-16
Monica Anne Laurente

HI Tousif, you were able to do it but may I ask how will you implement this for a specific input widget only not on the entire screen/block

2023-10-21 19-42-11
Tousif Khan
Champion

To make it specific we pass the Id of the input on which we want char to ristrict.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.