3 view form

So I have just created a form which has 3 views:

View1 - application/create.php: Display User data input form

View2 - application/confirm.php: Display Confirmation page

View3 - application/thanks.php: Display Thanks page

Now I can obviously POST all values from view1 to view2, but then I also need to post the values to view3 (this is where the values get saved to the database).

I am only displaying the values on view2, so is it possible to post the values dynamically via the controller, or do I need to set up individual hidden fields on view2?

hi!

you can use renderPartial, like update and create(using _form) (created by crud shell comand)

in create.php:




<?php echo $this->renderPartial('_form', array(

	'model'=>$model,

	'update'=>false,

)); ?>



This outputs the form with the layout in _form.php

That is working fine for me. So what do I do next?

Ok, I think now I understand

you have a code like this in your create action




  $model->attributes=$_POST['TableName']; 

  if ($model->validate()) 

      $this->render('confirm',array('model'=>$model));



and ,in confirm action, you have a code like




  $model->attributes=$_POST['TableName'];  // (***)

  $model->save() ;

  $this->render('thanks',array('model'=>$model));



and the options are

  1. hidden fields, for this to work (***)

    putting the same thing twice

  2. or try this




<?php echo CHtml::activeTextField($model,'fieldName',array('readonly'=>'readonly')); ?>



greetings, until next week, Merry Christmas