Forums

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

senzaesclusiva 21 Feb, 2020
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 21 Feb, 2020
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
senzaesclusiva 21 Feb, 2020
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 23 Feb, 2020
Hi senzaesclusiva,
return('success');
or
return('fail');
Bob
Max_admin 20 Jun, 2020
you could use Regex or Custom validation to do that!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.