Please fix the following input errors: Name cannot be blank. Phone cannot be blank.
I want it to output the following:
Error: Name cannot be blank, Phone cannot be blank.
How can I do this?
Posted 15 December 2009 - 07:12 AM
Please fix the following input errors: Name cannot be blank. Phone cannot be blank.
Error: Name cannot be blank, Phone cannot be blank.
Posted 15 December 2009 - 08:25 AM
GSTAR, on 15 December 2009 - 07:12 AM, said:
Please fix the following input errors: Name cannot be blank. Phone cannot be blank.
Error: Name cannot be blank, Phone cannot be blank.
Posted 15 December 2009 - 08:27 AM
Posted 29 November 2011 - 04:47 PM
GSTAR, on 15 December 2009 - 07:12 AM, said:
Please fix the following input errors: Name cannot be blank. Phone cannot be blank.
Error: Name cannot be blank, Phone cannot be blank.
div.form.errorSummary ul li
{
display: inline;
list-style-type: none;
}<?php echo $form->errorSummary($model,"",""); ?>
public static function errorSummary($model,$header=null,$footer=null,$htmlOptions=array())
{
$content='';
if(!is_array($model))
$model=array($model);
if(isset($htmlOptions['firstError']))
{
$firstError=$htmlOptions['firstError'];
unset($htmlOptions['firstError']);
}
else
$firstError=false;
foreach($model as $m)
{
foreach($m->getErrors() as $errors)
{
foreach($errors as $error)
{
if($error!='')
$content.="<li>$error</li>\n";
if($firstError)
break;
}
}
}
if($content!=='')
{
if($header===null)
$header='<p>'.Yii::t('yii','Please fix the following input errors:').'</p>';
if(!isset($htmlOptions['class']))
$htmlOptions['class']=self::$errorSummaryCss;
return self::tag('div',$htmlOptions,$header."\n<ul>\n$content</ul>".$footer);
}
else
return '';
}