Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I am working with smpt email form

when the user clicks on submit it should check the validation and send the code

Please help me how can i do it ?

This is the code with i done but i need validations...

example
C#
protected void Btn_Submit_Click(object sender, EventArgs e)
if{validation == true}
   {
    SendUserMail("mailid",txt_mail.text,"Hi How are you");
  
    string Body = "fname.text", "name.text", "mail.text";

    SendUserMail("mail", body);

     }
else 
{
messge box = please enter the fld 
}

Please tell me how can i write validation and how can i do this??
kindly provide me how to do it

i need validation code also all txt flds plz

example: if user clicks on submit it has to see all the txt boxes are filed or not
Posted
Updated 4-Jan-12 3:09am
v4
Comments
Rajesh Anuhya 4-Jan-12 9:03am    
Validation for what??? you mean email address??
manoharnch 4-Jan-12 9:07am    
no sir, for text flds

1 solution

use this javascript to validate email address

C#
function validateEmail(elementValue){
   var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
   return emailPattern.test(elementValue);
 }
 
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