Click here to Skip to main content
15,914,013 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have one textbox thats allow alphanumeric if user enters symbols show the alert message
'You have enter symbol do you want to continue'
 'yes/no
 
If click yes symbol is allowed.if click no symbol is not allowed. 


What I have tried:

I have tried some javascript this script not allowed to enter symbols.
Posted
Updated 5-Jun-17 23:15pm

1 solution

User Below code

function AllowAlphaNumeric() {
           var bool = check(document.getElementById("textbox").value);
           if (bool)
           {
               var r = confirm("You have enter symbol do you want to continue");
               if (r == false) {
                   document.getElementById("TEXTBOX").value = "";
               }
           }
       }
       function check(string) {
           var format = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;

           if (format.test(string)) {
               return true;
           } else
               return false;
       }
 
Share this answer
 
Comments
Raja Ganapathy 6-Jun-17 5:42am    
In this script i click cancel but not working. if i click cancel then it proceed the next process
Raja Ganapathy 7-Jun-17 7:27am    
Working Great

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900