How can I block specific e-mail domains? I want it where if the e-mail address a user puts in contains a specific domain (or list of domains) it will not allow the form to be processed. For example, if [email]john123@gmail.com[/email] would be the email address then it would be blocked as it's an [email]*@gmail.com[/email] email address.
Forums
Block e-mail domains
Hi krakerjax,
Something like this in a Custom Serverside validation action should to the trick:
Bob
Something like this in a Custom Serverside validation action should to the trick:
<?php
$ban_array = array(
'gmail.com',
'hotmail.com',
'aol.com'
);
$domain = explode('@', $form->data['email']);
if ( in_array($domain[1], $ban_array ) ) {
$form->validation_errors['email'] = "Invalid email domain";
return false;
}
?>
Not tested and may need debugging!Bob
Your code seems to work without a hitch. Unfortunately ChronoForms is not saving my conditions. I am also using ReCAPTCHA. I cannot put two separate conditions of ReCAPTCHA and the Server Side Validation. So, I created the server side validation, then, on success of server side validation it would check ReCAPTCHA. On success of ReCAPTCHA it would send the email and load the thank you message. On fail of server side validation or of ReCAPTCHA I had the same two conditions in each fail box of Load ReCAPTCHA and show html.
The issue is when I save these conditions it says it saved everything, however, under the Check ReCAPTCHA condition (On Success and On Fail) there is nothing in them. The send email or show thank you message in On Success of ReCAPTCHA nor the Load ReCAPTCHA or show html of the On Fail (see attached screenshot).
The issue is when I save these conditions it says it saved everything, however, under the Check ReCAPTCHA condition (On Success and On Fail) there is nothing in them. The send email or show thank you message in On Success of ReCAPTCHA nor the Load ReCAPTCHA or show html of the On Fail (see attached screenshot).
But where would one put the Email action? If you put it in the on Success of the server side validation then it sends the email even if the captcha is wrong.
Hi krackerjax,
In general don't use the On Success events, just the On Fail ones when you need to stop the form processing because there is an error.
Use the Event Loop to re-display the form and show the error messages - don't use Load Recaptcha and Show HTML there.
Bob
In general don't use the On Success events, just the On Fail ones when you need to stop the form processing because there is an error.
Use the Event Loop to re-display the form and show the error messages - don't use Load Recaptcha and Show HTML there.
Bob
OK. But where would I put the Email and Show Thanks Message actions at?
Hi krackerjax,
They go into the main On Submit event after the Check ReCaptcha and Validation actions.
Please see this FAQ which links to a tutorial document on working with events and actions.
Bob
They go into the main On Submit event after the Check ReCaptcha and Validation actions.
Please see this FAQ which links to a tutorial document on working with events and actions.
Bob
After looking at my setup for a minute I took out the nested conditions and had them as separate ones and that worked. I was trying to get too complex in the set/ordering of the conditions.
This topic is locked and no more replies can be posted.