2 Action Form In _Form

Hi!

How can i put two action form under _form with different action? Let’s just say I updated multiple row in form1 with different actionFields, and then the Form2 will update only the row1 and set it to null. 2 buttons with diffent actions…

Dear Friend

We can create two submit button with 2 submit URLs.




<div class="form">


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

	'id'=>'user-form',

	'enableAjaxValidation'=>true,

	

	),

)); ?>


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


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


	<div class="row">

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

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

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

	</div>


	<div class="row">

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

		<?php echo $form->textField($model,'age'); ?>

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

	</div>


	<div class="row">

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

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

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

	</div>


	<div class="row buttons">

		<?php echo CHtml::submitButton('action1',array(

                 "submit"=>array("test/one"),

                  )); 

                           //controllerid="test" and action id="one"

             ?>


                <?php echo CHtml::submitButton('action2',array(

                 "submit"=>array("test/two"),

                  ));

                          //controllerid="test" and action id="two"

              ?>

	</div>


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


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

<div id="test"></div>




I hope this helps you in some way.

Regards.