Buy Now
Sign in

Can't able to activate email field rules to avoid free domain mails on submit

senzaesclusiva , February 21 2020, 12:30
S
senzaesclusiva 2
February 21 2020, 12:30 #391321
I'm using chronoform5 in my company, but I can't find in any display the way to insert a rule to prevent free domain mails.
Can someone explain me how, or better yet, show me a demo that already includes it?

I'm using Webfoms in a Drupal site, and it's much more intuitive to insert rules in the 'validation' section.

In Chronoform instead I can't get the head round it.
Many, many thanks to who could help me
GreyHead 65
February 21 2020, 15:24 #391327
Hi senzaesclusiva,
You can use an Event Switcher and use PHP code there to check the email address against your list of 'free domains'.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
senzaesclusiva 2
February 21 2020, 16:45 #391332
Thanks, i found the way to add Event Switcher on submit action. I could try a php code like this
<?php
$email = $_POST['email'];
$domain = explode('@',$email)[1];

if($domain != 'amn.com', 'gmail.com', 'msn.com')
{
die('This domain is not allowed to register')
}
but how can i hook the events success,fail as described "your code should return a string matching one of the events names entered above, then this event will be processed." in the code form?
I'm not very expert on php coding
Thanks
GreyHead 65
February 23 2020, 10:36 #391342
Hi senzaesclusiva,
return('success');
or
return('fail');
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
admin 32
June 20 2020, 05:34 #393179
you could use Regex or Custom validation to do that!