Having two forms on one page

What I want is when someone goes to update or create he should be shown two forms with their respective submit buttons .

Right now when I go to update or create I get just one form .

How can I get two forms?

It is simple if used plain php and form tags but how about yii?

I think you need to use : http://www.yiiframework.com/doc/guide/1.1/en/form.table

There will be two seperate save buttons each for saving the fields above the respective button

Basically what you are telling is that you will clone the first form into a second one.

I believe doing like this in Yii default behavior will not work as expected because the fields from both forms will have same names/ids therefore ajax/client side validation will not work as expected, so collecting tabular input seems to be the way here.

I am trying this




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

	'id'=>'admin-form',

	'enableAjaxValidation'=>false,

)); ?>


	<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,'id'); ?>

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

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

	</div>





	<div class="row buttons">

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

	</div>


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



















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

	'id'=>'admin-form2',

	'enableAjaxValidation'=>false,

)); ?>


	<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,'id2'); ?>

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

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

	</div>





	<div class="row buttons">

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

	</div>


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







Just to be clear, in your case, who is id and who is id2 ? are these database columns? both of them ?

Yes id and id2 are 2 columns in the same table, there may be more columns in the table in future but they will be split in the two forms, for now there are just these two.