- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 10:59 AM
Hi All,
I have to write a email validation for email field, If user enter any invalid email it should through error, same way it should not allow any gmail or yahoo... it should accept only domain email id.
Could some one help on this.
Regards,
Roopa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 11:46 AM
Hi Roopa,
Please check the below script :
On change of email field
var inbox = g_form.getValue('email_field_name'); // give ur email field name on which u need to validate
var validRegExp = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
if (inbox.search(validRegExp) == -1 ||(inbox.includes("yahoo")==true)||((inbox.includes("gmail")==true))){
g_form.showFieldMsg('email_field_name', "invalid email address. " , 'error');
}
else if (inbox.search(validRegExp) == 0) {
g_form.showFieldMsg('email_field_name', "email address is valid" );
}
Regards,
MT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 11:46 AM
Hi Roopa,
Please check the below script :
On change of email field
var inbox = g_form.getValue('email_field_name'); // give ur email field name on which u need to validate
var validRegExp = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
if (inbox.search(validRegExp) == -1 ||(inbox.includes("yahoo")==true)||((inbox.includes("gmail")==true))){
g_form.showFieldMsg('email_field_name', "invalid email address. " , 'error');
}
else if (inbox.search(validRegExp) == 0) {
g_form.showFieldMsg('email_field_name', "email address is valid" );
}
Regards,
MT