If I want to avoid or remove all special characters within a input box or anyother field while doing a form validation, Is there any Built In Function available to do this?
You can create a client function in your app using javascript like below.
str.replace(/[^a-zA-Z0123456789]/g, "")
It will simply work.
you can test using the browser console by putting any special character.
const str = "abc's test#s"; console.log(str.replace(/[^a-zA-Z ]/g, "")); hope, you get my point.
const str = "abc's test#s";
console.log(str.replace(/[^a-zA-Z ]/g, ""));
hope, you get my point.
you can just remove numbers from the expression
(str.replace(/[^a-zA-Z0123456789]/g, "")); i mean you can you
(str.replace(/[^a-zA-Z0123456789]/g, ""));
i mean you can you
(str.replace(/[^a-zA-Z/g, "")); it will accept only a to zA to Z alphabet.
(str.replace(/[^a-zA-Z/g, ""));
it will accept only a to zA to Z alphabet.
There is already a post on forums with an answer provided by @Benjith Sam, let us know if it works for your use case.
This will help you when you are typing on the input, but you can use the expression just when you are going to the save action. This is up to you now and to the requirements, you have to follow.
https://www.outsystems.com/forums/discussion/62439/restrict-special-characters-in-input-field/
Kind Regards,
Márcio
Do you want to remove also numbers from the string along with special char?
Check created OML
https://amitj.outsystemscloud.com/DummyReactiveApp/Demo?_ts=637788875131343484
Created client action we can use anywhere on page for any type of widget.
Yeah bro.. I need to know that also and it would be very helpful if u provide how to do that also..
Thanks Regards,
Muthu Prabhakar