Multimodel form validations

My database is just like this

====== Group ======



===== Member =====






For multimodel form I followed this link .

and now my Group controller actionCreate() method is like this

  public function actionCreate()


    $model=new Group;

    $member=new Member;


    // Uncomment the following line if AJAX validation is needed

    // $this->performAjaxValidation($model);






















and my Group View _form.php is like this

<div class="form">

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



)); ?>

  <p class="note">Fields with <span class="required">*</span> are required.</p>

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

<!--  <?php echo $form->errorSummary(array($model,$member));?>-->

  <?php echo $form->errorSummary(array($model,$member));?>


  <div class="row">

    <?php echo $form->labelEx($model,'name'); ?>

    <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>80)); ?>

    <?php echo $form->error($model,'name'); ?>


  <div class="row">

    <?php echo $form->labelEx($member,'firstname'); ?>

    <?php echo $form->textField($member,'firstname',array('size'=>60,'maxlength'=>80)); ?>

    <?php echo $form->error($member,'firstname'); ?>


  <div class="row">

    <?php echo $form->labelEx($member,'lastname'); ?>

    <?php echo $form->textField($member,'lastname',array('size'=>60,'maxlength'=>80)); ?>

    <?php echo $form->error($member,'lastname'); ?>


  <div class="row">

    <?php echo $form->labelEx($member,'membersince'); ?>


    $this->widget('zii.widgets.jui.CJuiDatePicker', array(


      // additional javascript options for the date picker plugin










  <div class="row buttons">

    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>


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

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

Here both models are working good in save but when I am going to validate both models before save only the first model is doing valid but the second one is not doing any validate. Can some one guide me here.

If the second model (member) does not validate, what errors are returned?

Additionally, could you post the code that does the validation before saving?

Actually It is not showing any thing. Simply the blank fields are also going to save.

Your code is not optimal… as if there is a validation error in the $member the $model would be already saved…

Check again the article you referred to… you need to validate both models first… and only then save them both…