You need to sign in to do that
Don't have an account?

Replace Special Charaters with Null value in InputText
Hi,
I have a InputText field in Page <apex:inputText value="{!Coupon}"/>.
I need to make Special Characters to Null value while User typing special charaters in the free text box.
Kindly Help!
Regards,
Animesh
I have a InputText field in Page <apex:inputText value="{!Coupon}"/>.
I need to make Special Characters to Null value while User typing special charaters in the free text box.
Kindly Help!
Regards,
Animesh
Use String method replaceAll() to remove the special characters
String str;
str = str.replaceAll('[^a-z^A-z^0-9]', '');
Check the below link for reference
https://success.salesforce.com/answers?id=90630000000hRTkAAM
Regards,
Bhanu Mahesh
If you want to check while user type then you need to take help of javascript
Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
could you please clarify what is test in the if statement. "if (!re.test(f.value)) { "
Regards,
Animesh
Please find following code.
Thanks,
Himanshu
Thank you very much for the solution, but ondrop and onpaste does not work with <apex:inputText/>.
Now, special character are not coming when typing from keyboard, but if I paste special charater, it is still appearing. Is there any solution on it?
Regards,
Animesh