web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

validation using javascript

(0) ShareShare
ReportReport
Posted on by 828

how to perform validation of email id or any fields using javascript or jQuery ..!!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Nadeeja Bomiriya Profile Picture
    6,804 on at

    Hi Ram,

    As suggested by Guido, use onchange event to run some validation code. You can use regex to validate email. See example below.

    www.w3resource.com/.../email-validation.php

    Cheers,

    Nadeeja

  • Verified answer
    Drew Poggemann Profile Picture
    4 on at

    Hi Ram,

    Here is an article that provides an example for you as well.  

    abhishekserjam.wordpress.com/.../crm-2013-form-field-formatting-through-javascript-6-email-field-validation

    Hope this helps!

    Thanks,

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi,

    You can write the following code in javascript to validate email address in dynamics crm.

    function EmailTest(EmailField) {
      var Email = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9_.-]+\.[a-zA-Z]{2,}$/;
      if (Email.test(EmailField)) {
        return true;
      } else {
        return false;
      }
    }
    
    function CheckEmailString(context) {
      try {
        var EmailString = Xrm.Page.getAttribute("emailaddress1").getValue();
        if (EmailString != null) {
          var Flag = true;
    
          if (!EmailTest(EmailString)) {
            Flag = false;
          }
          if (Flag != true) {
            alert("Please check if the email might contain invalid format. Note that only one email address is allowed for this.");
            }
        }
      } catch (err) {
        alert(err.message);
      }
    }
  • Verified answer
    AbiRami Profile Picture
    516 on at

    Hi,

    See the below article to validate the email address. A video clip is also provided to explain how to add the code in crm and its complete working

    softchief.com/.../email-address-validation-javascript-dynamics-crm

  • nickmanny Profile Picture
    136 on at

    The following JavaScript shows how to validate email address using Regular Expression .

    function validateEmail(inText){
    const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    var email=document.getElementById(inText).value;
    if(re.test(String(email).toLowerCase()))
    {
    alert("Email is valid : " + email);
    }
    else
    {
    alert("Email is not valid : " + email);
    }
    }



  • shil12 Profile Picture
    30 on at

    Hi RamKumarb 

    Kindly go through the provided links below

    www.upgrad.com/.../

    stackoverflow.com/.../how-to-validate-an-email-address-in-javascript

    https://youtu.be/tG4xE9ycgsc

    Hope it helps!

    Regards,

    sh012

    website: https://www.dynamicslabs.io/

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans