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.
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;
}
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;
}