how to perform validation of email id or any fields using javascript or jQuery ..!!
*This post is locked for comments
how to perform validation of email id or any fields using javascript or jQuery ..!!
*This post is locked for comments
Hi RamKumarb
Kindly go through the provided links below
stackoverflow.com/.../how-to-validate-an-email-address-in-javascript
Hope it helps!
Regards,
sh012
website: https://www.dynamicslabs.io/
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);
}
}
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
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);
}
}
Hi Ram,
Here is an article that provides an example for you as well.
Hope this helps!
Thanks,
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
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,432
Most Valuable Professional
nmaenpaa
101,156