Extended email verification

InternEd 24 Jul, 2011
Hello,

I am working on a form where I want 'advanced' email-verification.
Besides the normal verification, I also want to disallow email addresses with domains like e.g.gmail.com, hotmail.com, live.com.

Is there a way to do this?

Thanks!

Regards, Ed.
GreyHead 25 Jul, 2011
Hi Ed,

You could do this fairly easily with serverside validation. What do you want to happen with those domains?

Bob
InternEd 25 Jul, 2011
Hi,

The form is for business purposes, so we only want people to use their business email address. So if the email-domain is hotmal.com e.g. I want to display a message that the email address is unusable and they have to enter another address.

Regards, Ed
GreyHead 25 Jul, 2011
Hi Ed,

OK - then Serverside validation is the way to go.

Bob
InternEd 28 Jul, 2011
Hi,

Then I guess I'll have to dive into coding php :-)
I bought the 'Cookbook' ebook to have a starting point.
Do you maybe know a recipe in there that I could use as a basis for this validation?

Ed
GreyHead 28 Jul, 2011
Hi Ed,

In Cfv4 the code would be something like this:
<?php
$email = $form->data['email'];
if ( !$email ) {
  return true;
}
$email = explode('@', $email);
$domain = explode('.', $email[1]);
$domain = $domain[0];
if ( in_array( $domain, array('gmail', 'live', 'hotmail', 'aol', 'yahoo')) ) {
  $form->validation_errors['email'] = "Invalid email account.";
  return false;
}
?>

Bob
InternEd 28 Jul, 2011
Thanks!

I see you wrote it in V4 code.
As I wrote, I'm just starting out using Chronoform, but intend to use it on every site I need forms from now on.
Would you advice learning and using V4? I am a little reluctant, since I saw it is RC and V3 is fully developed.

Regards, Ed
GreyHead 28 Jul, 2011
Hi Ed,

If you are starting out use CFV4. It still has a few bugs (there's a list of known ones in the CFV4 forum) but it's generally very robust and is supported on Joomla! 1.6/1.7 which CFv3 will not be. The learning curve is a bit steep to start with but it is a much more flexible product than CFv3.

Bob

PS In CFv3 the code would be similar.
InternEd 31 Jul, 2011
Well, I installed V4 now, and you were right. It's a bit steep curve😉

Expect me to come back here and bug you with some more questions.

BTW, I already had made V3 form. I copied the HTML code and pasted it in the Custom code field of a new form I made in V4 (on my testsite). The formatting seems so be gone. Is that something I could simply correct or do I better remake the form in V4?

Here you see the form in V3 with the good formatting:
http://www.bundlecommander.com/index.php?option=com_chronocontact&chronoformname=Request_license

Here on the testsite the V4 version:
http://www.fotocursuswestland.nl/index.php?option=com_chronoforms&chronoform=testBC

Thanks!
GreyHead 31 Jul, 2011
Hi Ed,

The problem with the formatting is that CFv4 uses different CSS classes and different CSS files so the formatting does not carry over. That's one of the reasons why recommend rebuilding simple forms in Cfv4 - it just isn't worth the hassle involved in getting the CSS to work.

Bob
InternEd 01 Aug, 2011
Hi,

I rebuilt the form in CFv4. But I'm not shure where to put the code in you gave me earlier.
In advanced edit I added a event 'custom code' as the first event in the 'after submit' section.
In the custom code I choose 'view' and pasted the code in the codefield.

When I execute the form with a gmail address, I don't get a message that the address is not allowed. I do get the Thank You message, and the email I built is sent.

However, when I but in a gmail address AND a wrong captcha, I get the message both are wrong. But if I only correct the captcha, the form is accepted.

Can you point out where I went wrong?

Thanks, Ed.
InternEd 01 Aug, 2011
I think I got it.
I changed the custom code to a Custom Server side validation and
I added a 'event loop' in the OnFail action.
Now it works🙂
This topic is locked and no more replies can be posted.