how to verify that two email addresses on a form are an exact match

Asked By steven
02-Sep-10 07:14 AM
Earn up to 0 extra points for answering this tough question.
Hi, how do i verify that two email addresses on an form are an exact match using javascript?

  re: how to verify that two email addresses on a form are an exact match

Sasha Kotlo replied to steven
02-Sep-10 07:24 AM
well it's easy..

var email1 = document.getElementById("email1").value;
var email2 = document.getElementById("email2").value;

if(email1 == email2)
{
alert("Match");
}
else
{
alert("No Match");
}

Simple right?

Regards.

  re: how to verify that two email addresses on a form are an exact match

Goniey N replied to steven
03-Sep-10 06:26 AM
-- First Of All You Have To Check That Is Given Value Is Email Address Or Not?
-- If Yes Then Compare & If No Then Display Message That Enter Email Address...

-- Code For Checks Of Email Address...

01.<script type="text/javascript" >
02.  function CheckEmail()
03.  {
04.    var strEmail1 = document.getElementById('<%=TextBox1.ClientID%>').value;
05.    var strEmail2 = document.getElementById('<%=TextBox2.ClientID%>').value;
06.    var objRegex = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
07. 
08.    if((objRegex.test(strEmail1) == true) && (objRegex.test(strEmail2) ==true))
09.    {
10.      if(strEmail1 == strEmail2)
11.      {
12.        //Here Both Are Exact Match, So Write Here Your Code...
13.        alert("Both Values Are Exact Match.");
14.      }
15.      else
16.      {
17.        alert("Both Values Are Not Exact Match.");
18.      }
19.    }
20.    else
21.    {
22.      alert("Please Enter Email Address.");
23.    }
24.  }
25.</script>


01.<body>
02.  <form style="" id="form1" runat="server">
03.  <div>
04.    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
05.    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
06.    <asp:Button ID="Button1" OnClientClick="CheckEmail()" runat="server"OnClick="Button1_Click" Text="Click Here" />
07.  </ div>
08.  </form>
09.</body>



-- For More Clear View See Below Images :



-- Here I Enter Same Value But In Different Case :




-- Here I Entered Both Same Value :



-- Here I Entered Different Value that Email Address :




-- It Will Work 100%.....

-- Hope This Will Help You...

  re: how to verify that two email addresses on a form are an exact match

steven replied to Goniey N
03-Sep-10 08:36 AM
thanks.
Create New Account
javascript Hi, external javascript function does not calling in asp.net master pages.how explain me. regards, For this you have to include that javascript file like this- <script src = "JQuerJS / jquery-1.4.2.js" type = "text / javascript"> < / script> hi Try this in your header to make sure the path is always correct <script type = "text / javascript" language = "javascript" src = '<% = Page.ResolveClientUrl("~ / js / Default.js") %> ' > < / script> instead of <script type = "text / javascript" language = "javascript" src = "js / Default.js" / > function Fvalidate() { var control; if (control blank!"; control.value = ""; control.focus(); return false; } if (!control.value.match( / ^[a-zA-Z]+$ / ) && control.value ! = "") { fnamevalid.innerText = " *Please Enter alphabets blank!"; control.value = ""; control.focus(); return false; } if (!control.value.match( / ^[a-zA-Z]+$ / ) && control.value ! = "") { lnamevalid.innerText = " *Please Enter alphabets
11 Ways to use JavaScript efficiently This article shows 11 ways to use Javascript efficiently 11 Ways to use JavaScript efficiently. JavaScript is a powerful Scripting language, which has matured into a Server. Below are 11 ways that I found to use JavaScript efficiently. These could be the use of inbuilt features as writing Scripts. i) Use Inbuilt Functions to perform Common Functions: JavaScript has several built in functions to accomplish common functions. Use certainly take up some client resources. iii) Use Caching in JavaScript. It Improves Performance. Along with caching the objects, you can to make them run faster, by using an optimized conditional. JavaScript often repeatedly accesses a certain object, for instance: <script language = "JavaScript"> for (i = 0;i<document.images.length;i++) document.images variable instead of the actual object. Like this: <script language = "JavaScript"> var theimages = document.images for (i = 0;i<theimages.length
that two email addresses on a form are an exact match Hi, how do i verify that two email addresses on an form are an exact match using javascript? well it's easy. . var email1 = document.getElementById("email1").value var email2 = document.getElementById("email2").value; if(email1 = = email2) { alert("Match"); } else { alert("No Match"); } Simple right? Regards. - - First Of All You Have To Check Code For Checks Of Email Address. . . 01. <script type = "text / javascript" > 02. function CheckEmail() 03. { 04. var strEmail1 = document.getElementById( '<% = TextBox1 10. if (strEmail1 = = strEmail2) 11. { 12. / / Here Both Are Exact Match, So Write Here Your Code. . . 13. alert( "Both Values Are Exact Match." ); 14. } 15. else 16. { 17. alert( "Both Values Are Not Exact Match." ); 18. } 19. } 20. else 21. { 22. alert( "Please Enter Email
only numbers? can somone give me a javascript function to allow only numbers and not more than 3 digits? http: / / www.mattkruse.com / javascript / validations / <script language = "JavaScript" type = "text / javascript"> var frmvalidator = new Validator("myform"); frmvalidator.addValidation("Phone", "maxlen = 3 val); var re = new RegExp("^[0-9]{3}$"); if(val.match(re)) { alert("OK"); } else { alert("NOT OK "); } } http: / / sarahk.pcpropertymanager.com / muck / multi-javascript.php Create New Account
match() and exec() Hi, Can anyone please explain me what is the difference between match() and exec() methods of javascript? I googled for it but not able to make out should be used which method. Thx in advance Shilpa Both match() and exec() works almost same, but the main different between these two function i know is: match() returns an array or matches when passed a global regular expression and exec() in contrast always return a single match and provides complete information of that match. Thanks The match() method searches for a match between a regular expression and a string, and returns the method returns an array of matches, or null if no match is found. The exec() method tests for a match in
JavaScript HI, i need a email validator in javaScript, which can able to judge is it a a valid There may be more than 1 dot) Here's a javascript that you can use to validate an email address, taken link: http: / / www.freshmango.com / support / kb / web-design-programming / javascript / javascript-email-validation-with-regular-expressions / <script type = "text / javascript"> function validateEmail(){ var emailRegEx = / ^([a-zA-Z0-9_ \ . \ -])+ \ @(([a-zA 9]{2, 4})+$ / ; str = document.getElementById('emailAddress').value; if(str.match(emailRegEx)){ document.mailingListForm.submit(); }else{ alert('Please enter a valid SQL Server Helper <title> Check Email Address< / title> <script language = "javascript"> function checkEmail(inputvalue){ var pattern = / ^([a-zA-Z0-9_.-])+@([a alpha bate). for example-abc_123.xyz@gmail.com <script language = "Javascript"> function echeck(str) { var at = "@" var dot = "." var lat = str address. Please try again."); form.email.select(); return false; } The Javascript website here provides most of the scripts that are needed
txt" ; / / regular expression string pattern = @"(?:href \ s* = )(?:[ \ s" "']*)(?!# | mailto | location. | javascript | .*css | .*this \ .)(? .*?)(?:[ \ s> " "'])" ; / / Set up regex object Regex RegExpr = new Regex(pattern, RegexOptions.IgnoreCase); / / get the first match Match match = RegExpr Match(content); / / loop through matches while (match.Success) { / / output the match info Console.WriteLine( "href match: " + match.Groups[0].Value); WriteToLog(LocalFile, "href match: " + match.Groups[0].Value + " \ r \ n" ); Console.WriteLine( "Url match
Javascript - Find the .Net framework versions installed on a computer. Use the following script. <script language = "JavaScript" type = "text / javascript"> var versions = navigator.userAgent.match( / \ .NET CLR [0-9.]+ / g); if (versions = = null) document.write browser for HTML5 Compatibility on the various standards and specifications Javascript - Find the .Net framework versions installed on a computer. ( 141 Views ) View [)ia6l0 iii's FAQs Create New Account keywords: JavaScript, .Net, userAgent description: Use the following script.