154
Views
9
Comments
How to restrict user to enter Alphabets and some special Characters in text input box
Application Type
Reactive

Hi Team,

Can anyone help me in restricting user to enter Alphabets and some special characters too.
I want to do on On Change . 

It would be a great help



Thanks

2019-11-11 17-10-24
Manish Jawla
 
MVP

Hi @Sourav Sandhu ,

You can check the below component for reference :

https://www.outsystems.com/forge/component-overview/11214/reactive-client-side-validation 

Here you will find the various example.

Hope this helps.

Regards,

Manish Jawla

2023-08-28 07-00-10
Paulo Torres
Champion

Hello,

If you want to avoid completely the user insert certain chars this component works very well: https://www.outsystems.com/forge/component-overview/8005/restrict-chars-reactive

Regards

2025-08-03 07-20-35
Mythily - EONE

Hi Saurav,

This pattern only allows the number. Call this action in onchange of Input.

Thanks

UserImage.jpg
Sourav Sandhu

Hi

If I want to add + sign as well then what would be the regex...."^[0-9]+$". Is it like this ?

UserImage.jpg
Sourav Sandhu

Also I don't want to highlight the input with message. Requirement is user should not even type any alphabet

2024-12-02 12-15-17
Aravind EONE

Hi Sourav,

It is based on your UX.

1. If you want to prevent typing the desired characters itself on the input field you can use regex in javascript e.preventDefault or return null on change of the input action.

2. If you want to allow user to type it and validate it with a message u can follow as Mythily suggested.

2024-05-08 06-29-37
Prince Aadil Khan Panwar

Hi Sourav Sandhu ,

i saw your problem. you can try with this javascript code in javascript.

function onlyLettersAndSpaces(str) 

{  

      return Boolean(str?.match(/^[A-Za-z\s]*$/)); 


output parameter=conlyLettersAndSpaces(input parameter )


input parameter should be in text format and output parameter should be boolean.

Thanks

Prince

2025-09-25 14-38-22
Lokesh Kumar Yadav

Hi Saurabh 

Please go with this file which I attached It will help you

Restrict Alphabets.oap
2023-11-22 10-51-50
Jozy Sohail

Hi ,

Try using this regex in your regex search '^[0-9][-+][0-9]+$' .


Hope it helps

Thanks

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