Multi Level Form

Hello Guys,

       Dhananjay Here, I want to do multi level form so can some help me out,plz send a code and steps for it.thank you

What have to do in particular?

hi

please explain more!

I Have one form with more fields,so i want to divide the fields it in multiple tabs and on one submit it must insert record in the table.And with all validation. thank you for reply.

<form>

<div id="firstpage">

<!–contain some fields you want --!>

&#036;model

</div>

<div id="second page">

<!–remaining function–>

< submit Here >

$model

</div>

</form>

<button>

<!–use jQuery toggle option for Hide and Show -->

</button>

Use this concept , It will work out.

yup i used tht thing but its not working proper can u explain more about it… thank you.

Paste Your code Here!!!

I am using thiz for many forms, i think you did some mistake in your code.


<?php /* @var $this TestController */ /* @var $model Test */ /* @var $form CActiveForm */ ?> 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>  <div class="form"> 

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

// Please note: When you enable ajax validation, make sure the corresponding 	

// controller action is handling ajax validation correctly. 

// There is a call to performAjaxValidation() commented in generated controller code. 	

// See class documentation of CActiveForm for details on this. 	

'enableAjaxValidation'=>false, )); 

?>  	

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

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

<div id="hideshow"> 	

<div class="row"> 		

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

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

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

</div> 	

<input type="button" value="Next" id="next" > 

</div> <div id="showhide" style="display:none;"> 	

<div class="row"> 	

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

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

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

</div> 	<input type="button" value="Previous" id="previous" > 	

<div class="row buttons">           

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

</div>  

</div>  

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

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

<script>                      

$("#next").click(function(){                       

$("#hideshow").hide();                         

$("#showhide").show();                     

});                      

$("#previous").click(function(){                       

$("#showhide").hide();                       

$("#hideshow").show();                     

}); </script>

Same thing You did for Multi level models it will work cent percent!!!

I think Yoy have mistake in Controller. for Multi level form submission(mean more than a one model) you have to handle two save function for each model.

This link Helps You for That Type.

plz see this links :

My link

My link

thank you sir its working …thanks a lot

Hello Respected Ilaiya,

If you are on the 3 steps and suddenly any error is occurred that time you need to refresh the page and again you will be on first step. so, its not to good way. please use the wizard-behavior so you can handle such types issues.

http://www.yiiframew…izard-behavior/

Download the code and study on that, it’s truly easily and not need to use tabs mechanism.

See demo - http://wizard-behavi…gistration/user

TnQ u Dhananjay!! But Your Link is Not Working. Plz Share Nice one…