I am using Regex to validate email address because I need to prevent users from using free email accounts such as gmail or outlook and ... .
I have the following and it works fine:
When I test the following line in Regex tested it works but it doesn't work in Chronoform:
Thanks
I have the following and it works fine:
^\b[\w\.-]+@((?!gmail|outlook|hotmail).)[\w\.-]+\.\w{2,4}\b$The problem is that with the above Regex users can register with abc@GMAIL.com. The above Regex is not case sensitive.
When I test the following line in Regex tested it works but it doesn't work in Chronoform:
^\b[\w\.-]+@((?!(?i)gmail|outlook|hotmail).)[\w\.-]+\.\w{2,4}\b$I'm not sure why the above line doesn't work in CF 6.
Thanks
Hi omidhz,
The simplest fix is probably to change the email address to all lower case before checking - though the \i flag will usually make the check case-insensitive.
Bob
PS There are many genuine users who have GMail or other similar addresses - are you certain that you want to block them?
The simplest fix is probably to change the email address to all lower case before checking - though the \i flag will usually make the check case-insensitive.
Bob
PS There are many genuine users who have GMail or other similar addresses - are you certain that you want to block them?
Thank you for your reply. I tried to change the characters to lower case, but I can't figure out how. Can you help, please?
Thanks
Thanks
Hi omidhz,
I think using PHP action with something like this should work
<?php
$this->data('email') = strtolower($this->data('email'));
?>
Bob
I think using PHP action with something like this should work
<?php
$this->data('email') = strtolower($this->data('email'));
?>
Bob
Thanks Bob,
When I add
When I add
$this->data('email') = strtolower($this->data('email'));to the php in the actions of the page that has the email field, I get error 500.
No.
$this->data('email', strtolower($this->data('email')), true);
Thank you healyhatman.
Your line does not give error message. But it is not doing what I wanted.
Let me know if I'm doing something wrong.
On my page 3 of the form, I have a field called email, I'm using the Regex posted above to block gmail and other free emils listed. I add a php in action of page 3 and your code there. When users type in their email, it still shows uppercase as they type and are still able to register with me@GMAIL.com.
Thanks again for your reply.
Your line does not give error message. But it is not doing what I wanted.
Let me know if I'm doing something wrong.
On my page 3 of the form, I have a field called email, I'm using the Regex posted above to block gmail and other free emils listed. I add a php in action of page 3 and your code there. When users type in their email, it still shows uppercase as they type and are still able to register with me@GMAIL.com.
Thanks again for your reply.
This topic is locked and no more replies can be posted.