I have this form:
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'login-form',
'enableClientValidation' => true,
'clientOptions' => array(
'validateOnSubmit' => true,
),
));
$errorMsg = $form->errorSummary($userModel, "", "");
if(!empty($errorMsg))
{
echo '<div class="alert alert-danger" style="text-align:center; width:800px; margin:auto;">' . $errorMsg . '</div>';
echo '<br>';
}
$form->labelEx($userModel, 'email');
echo $form->textField($userModel, 'email');
$form->error($userModel, 'email');
?>
I am trying to print the error message when the email is invalid, but I want to print it using the red background from bootstrap. The problem is that without any errors it still shows the red bar.
It seems that this happens because errorSummary()
is never really null
output: