Hi everyone, I am troubling with removing special character from user input box. I have "name" input box in form. If the user enter their name with something like this "Kyaw, Kyaw" I want to remove "," from name. How should i do that?
Hi,
You might want to do this in the other way around, if the user inserts invalid characters , they should get a error saying that special characters are not allowed. The validation would require something like a regex that would only allow letters, spaces and numbers, if it makes sense to have them.
In case you really want to remove those characters, you would need to use Replace function but you would probably end up building this, that doesn't look pretty.
or you can try using Regex_Replace from Text extension
Gabriel
Gabriel Cardoso wrote:
Very thank you Gabriel Cardoso, I use the regex_replace as us described in picture and it really works!
You can use this component from forge:
Cheers,Nuno Verdasca
How about replacing forward slash in the string? I have tried Replace function with escape sequence like "\ /" but no luck.
thanks for the answer. i will put it here as text so that others can just copy and paste solution
Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Var1,",",""),"#",""),"-",""),"\",""),"/",""),"'",""),"(",""),")",""),".",""),"&","")
Hii,
To remove a special character, such as a comma (",") from a user's input in a text field, you can use a simple string manipulation function or regular expression. Here's an example using JavaScript:
// Get the value from the input field
var userInput = document.getElementById("name").value;
// Remove the comma from the user input
var cleanedInput = userInput.replace(",", "");
// Use the cleaned input as needed
console.log(cleanedInput);
In this example, we first retrieve the value entered by the user in the "name" input field. Then, we use the replace() function to replace all occurrences of the comma with an empty string, effectively removing it from the input. The resulting cleaned input is stored in the cleanedInput variable, which you can use further in your code as needed.
Thank you