Click here to Skip to main content
16,004,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I had did the form validation only for required field but i want other validations also like check email validity,range validity for phone nos etc...and also i have to get a "?" symbol button. By clicking that we have to display the error message.. How can i write the code for that?
Posted
Comments
satyaanupama 21-Oct-13 1:45am    
just simply display ur meg by using mesagebox tag...

1 solution

C#
if(document.getElementById('ctl00_MainContent_txtEmailID').value == "" || !ValidateEmail(document.getElementById('ctl00_MainContent_txtEmailID')))
          {
              alert('Please Enter Valid Email');
              document.getElementById('ctl00_MainContent_txtEmailID').value = '';
              document.getElementById('ctl00_MainContent_txtEmailID').focus();
              return false;
          }

this is for validation ofn email id

C#
if(document.getElementById('ctl00_MainContent_txtMobileNumber').value == "" || !PhoneNumber(document.getElementById("ctl00_MainContent_txtMobileNumber")))
           {
               alert('Please Enter Valid Mobile Number');
               document.getElementById('ctl00_MainContent_txtMobileNumber').value = '';
               document.getElementById('ctl00_MainContent_txtMobileNumber').focus();
               return false;
           }



this is fopr validation of mobile number...
hope it will helpfull..
 
Share this answer
 

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