2

I am developing component and I want to know how to validate email value entered by user using joomla 1.7?

JHTML::_('behavior.formvalidation') without using this method.

2 Answers2

2

Try this,

function validate()
{
    jimport('joomla.mail.helper');

    $valid = true;

     if ($this->_data->email && !JMailHelper::isEmailAddress($this->_data->email))
    {           
         $this->_app->enqueueMessage(JText::_('Invalid Email Address'),'error');                       
         $valid = false;           
    }   
    return $valid; 
}
Sara
  • 14,098
  • 13
  • 34
  • 50
0
function validate($email)
{
jimport('joomla.mail.helper');

       $error   = false;
if (! $email  || ! JMailHelper::isEmailAddress($email))
{
    $error  = JText::sprintf('Email Corect', $email);
    JError::raiseWarning(0, $error);
}

 return $error;
}
MAG TOR
  • 129
  • 1
  • 3