Unique Email Address

srivi281992 31 Aug, 2015
Hi,
I have created a form and it should not accept more than 1 post from an email id and display message as "email already exists" . I created an event switcher after the Check Security question in the OnSubmit . I have pasted this code in the code section of the event switcher
<?php
$db =& JFactory::getDBO();
$query = "
  SELECT COUNT(*)
    FROM hem8w_chronoengine_chronoforms_datatable_know_more1
    WHERE email = '{$form->data['email']}' ;
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count ) {
  $form->validation_errors['email'] = "Used email.";
  return "fail";
}
?>
If I enter the email id that is already registered in the database it doesn't show any message as "fail" or "used email". But the entry is not stored in the database. i want to display a message to the user as well. How can it be done?
GreyHead 01 Sep, 2015
Hi srivi281992,

Have you added Display Message and Event Loop actions to the On Fail box of the Event Switcher?

Bob
This topic is locked and no more replies can be posted.