errorSummary not display ?

hello all :)

i have problem when use Ajax validation, because error message display only one field.

I try to attach an example display.

there are two fields that are not filled there should be both an error message, but one thing is there is the error message.

this validation code at Model class:




public function rules()

	{

		return array(

			array('username, password', 'required'),




		);

	}



in view :




<?php $form=$this->beginWidget('CActiveForm', array(

        'id'=>'doy-form',

        'enableAjaxValidation'=>true,

		'enableClientValidation'=>true,

		'focus'=>array($doy,'username'),

)); ?>

        <?php echo $form->errorSummary($doy); ?>



I’ve tried to find their own answers in this website, but there is still no solution.

please help for this case

added that this relates to RenderPartial

thank you :)

hello :)

anyone can help?

I’ve tried several ways but the result is still the same.

if it is less clear with my question, I will explain more fully.

whether the same case with this issue?

Just to clarify…

When the input is in the first field… and you skip to the second field… only the first field error will be displayed…

When the input is in the second field… and you skip to the third or first field… the error for the second field should be displayed…

Both errors should be displayed if you click a submit button (Create)…

If this does not help you… post here your complete view form code…

thanks for the response. :)

yes, what I want when the username and password fields blank then there is a direct error messages to the two fields it.

I try to describe the code that I have like this:

Controller




<?php

class TestController extends Controller {

	


	public function actionIndex(){

		$this->render('/test/Test');

	}

	

	public function actionAddnew(){

		$model=new TestModel;

		$this->performAjaxValidation($model);

		if(isset($_POST['Doy'])){

			echo 'test';

		} else {

			$this->renderPartial('/test/_form1',array('doy'=>$model),false,true);

		}

	}

	protected function performAjaxValidation($model)

	{

		if(isset($_POST['ajax']) && $_POST['ajax']==='doy-form')

		{

			echo CActiveForm::validate($model);

			Yii::app()->end();

		}

	}





}

?>



Model




<?php


class TestModel extends CFormModel {

	public $username;

	public $password;

	

	public function rules(){

		 return array(

                        array('username, password', 'required'),




                );

	}

}



Partial page




<div class="wide form" >

<?php $form=$this->beginWidget('CActiveForm', array(

        'id'=>'doy-form',

        'enableAjaxValidation'=>true,

		'enableClientValidation'=>true,

                'focus'=>array($doy,'username'),

)); ?>

<?php echo CHtml::errorSummary($doy); ?>

<div class="row">

    <?php echo $form->labelEx($doy,'username'); ?>

    <?php echo $form->textField($doy,'username'); ?>

    <?php echo $form->error($doy,'username'); ?>

</div>

<div class="row">

    <?php echo $form->labelEx($doy,'password'); ?>

    <?php echo $form->textField($doy,'password'); ?>

    <?php echo $form->error($doy,'password'); ?>

</div>

<div class="row buttons">

                <?php echo CHtml::ajaxSubmitButton(Yii::t('forms','Create'),CHtml::normalizeUrl(array('test/addnew'),array('replace'=>'#doy'))); ?>


        </div>


       

<?php $this->endWidget(); ?>

</div><!-- form -->



Test View




<div id="doy">


<?php echo CHtml::ajaxLink("Link Test",$this->createUrl('/test/addnew'),array('replace'=>'#doy'));?>

</div>



I want validation as in the picture which I enclose, when click the Create button.

but it happens I have to click one by one new field press create then the error appears.

and this response when i click register button




<script type="text/javascript" src="/yii/prj/cbj/assets/23b09f94/jquery.js"></script>

<script type="text/javascript" src="/yii/prj/cbj/assets/23b09f94/jquery.yiiactiveform.js"></script>




<div class="wide form" >


<form id="doy-form" action="/yii/prj/cbj/index.php/site/test3" method="post">        





        <div class="row">


                <label for="TestForm_username" class="required">Username <span class="required">*</span></label>                <input size="20" maxlength="20" name="TestForm[username]" id="TestForm_username" type="text" />                <div id="TestForm_username_em_" class="errorMessage" style="display:none"></div>        </div>





        <div class="row">


                <label for="TestForm_password" class="required">Password <span class="required">*</span></label>                <input size="60" maxlength="90" name="TestForm[password]" id="TestForm_password" type="text" />                <div id="TestForm_password_em_" class="errorMessage" style="display:none"></div>        </div>


        <div class="row">


                <label for="TestForm_email" class="required">Email Anda <span class="required">*</span></label>                <input name="TestForm[email]" id="TestForm_email" type="text" />                <div id="TestForm_email_em_" class="errorMessage" style="display:none"></div>        </div>


        <div class="row buttons">


                <input type="submit" name="yt0" value="Test" id="yt0" />


        </div>


</form></div><!-- form -->


<script type="text/javascript">

/*<![CDATA[*/

jQuery('body').undelegate('#yt0','click').delegate('#yt0','click',function(){jQuery.ajax({'type':'POST','success':function(data){


							


						  },'url':'/yii/prj/cbj/index.php/site/test3','cache':false,'data':jQuery(this).parents("form").serialize()});return false;});

$('#doy-form').yiiactiveform({'validateOnSubmit':true,'attributes':[{'id':'TestForm_username','inputID':'TestForm_username','errorID':'TestForm_username_em_','model':'TestForm','name':'username','enableAjaxValidation':true,'clientValidation':function(value, messages, attribute) {


if($.trim(value)=='') {

	messages.push("Username cannot be blank.");

}


}},{'id':'TestForm_password','inputID':'TestForm_password','errorID':'TestForm_password_em_','model':'TestForm','name':'password','enableAjaxValidation':true,'clientValidation':function(value, messages, attribute) {


if($.trim(value)=='') {

	messages.push("Password cannot be blank.");

}


}},{'id':'TestForm_email','inputID':'TestForm_email','errorID':'TestForm_email_em_','model':'TestForm','name':'email','enableAjaxValidation':true,'clientValidation':function(value, messages, attribute) {


if($.trim(value)=='') {

	messages.push("Email Anda cannot be blank.");

}


}}],'focus':'input[type=\"text\"]:first'});

/*]]>*/

</script>



POST




Parametersapplication/x-www-form-urlencoded

TestForm[email]	

TestForm[password]	

TestForm[username]	

Source

TestForm%5Busername%5D=&TestForm%5Bpassword%5D=&TestForm%5Bemail%5D=