Hi,
I wish I can Block Free Emails (Gmail, Yahoo) and allow Business emails in forms. I've seen how to do so with server side validation, but I wish I can do it wit client-side validation.
Any advice?
Thanks
I wish I can Block Free Emails (Gmail, Yahoo) and allow Business emails in forms. I've seen how to do so with server side validation, but I wish I can do it wit client-side validation.
Any advice?
Thanks
You want to block the largest email providers in the world? Well sure off you go, you can make a custom JS validation there's a FAQ about it.
https://www.chronoengine.com/faqs/74-chronoforms/chronoforms6/5293-validating-fields
https://www.chronoengine.com/faqs/74-chronoforms/chronoforms6/5293-validating-fields
Hi Healyhatman,
as a matter of fact I need people's corporate email adress and I want to prevent them to put generic email adress.
I've already found a very good post by Greyhead :
https://www.chronoengine.com/forums/posts/t84695/block-e-mail-domains
But in this post it seems to me that it is a server side validation in php. I need instead a a client side validation.
So I though I need to put the name of a javascript piece of code in the Custom Function Box of the element I need to validate. Can I put a php code instead ?
Thanks!
as a matter of fact I need people's corporate email adress and I want to prevent them to put generic email adress.
I've already found a very good post by Greyhead :
https://www.chronoengine.com/forums/posts/t84695/block-e-mail-domains
But in this post it seems to me that it is a server side validation in php. I need instead a a client side validation.
So I though I need to put the name of a javascript piece of code in the Custom Function Box of the element I need to validate. Can I put a php code instead ?
Thanks!
No you can't, because PHP is serverside code. You'll have to code it yourself. Also be aware that a lot of small businesses still use GMail addresses, especially if they don't have their own website and sometimes even if they do.
Thanks Healyhatman!
http://www.sagarnangare.net/javascript-validation-code-to-block-free-emails-gmail-yahoo-allow-business-emails-in-forms/
With modifications
With modifications
jQuery.fn.form.settings.rules.nofreemails = function(value) {Then in your validation rules for the field you would put
var reg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)(?!yahoo.co.in)(?!aol.com)(?!abc.com)(?!xyz.com)(?!pqr.com)(?!rediffmail.com)(?!live.com)(?!outlook.com)(?!me.com)(?!msn.com)(?!ymail.com)([\w-]+\.)+[\w-]{2,4})?$/;
return !(reg.test(value));
};
nofreemails:You must not use a free email, only corporate emails are allowed!
This topic is locked and no more replies can be posted.