"2nd step form" and messages questions

Hi :) Yii’s great by the way…

  1. I have to questions. What's for the $category variable in Yii::t method

  2. I'd like to create a form that would be divided into two parts, ie: user fills up first part, clicks "Go to second step" and then fills up a second form. In the second form he would have a button called "Change options" so he could go back to the first part and change submitted input.

I'm just thinking how that could be achieved in a good way.

Thank you in advance

Michael.

  1. $category is used to classify your messages. For example, all core messages in Yii belong to 'yii' category. For application messages, you can classify them into one or several categories.

  2. You can save the form inputs in session.

thx for quick reply :)

Quote

1. $category is used to classify your messages. For example, all core messages in Yii belong to 'yii' category. For application messages, you can classify them into one or several categories.

category yii means yii.php translation file ?

Quote

2. You can save the form inputs in session.

will do

I have many fields in my form under same name like

companyName[0] and so on…

how can I add an error to only one selected field like this:



// that does not work


$model->addError('companyName[0]', 'error message');





// that works but for all fields in the form


$model->addError('companyName', 'error message');


Yes, if you use CPhpMessageSource (default), the category name is the message file name.

Do you mean companyName is an array and each value corresponds to a text field? It doesn’t sound right to me… Maybe you want to do this? http://www.yiiframew…uide/form.table

so what does:



$items=$this->getItemsToUpdate();


do ?

It returns an array of model objects that will be used to store user form inputs.

shame, i don’t know how that method should look like  ???

If you are creating these objects, it's a simple foreach loop with "new" operators.

If you are updating existing data, it could be the findAll() result of a model class.

so far everything is ok… what about the errorSummary ? you did not write anything about it in the guide

errorSummary is per model. I don't think it is appropriate to put error messages from every model into the same summary. Instead, you may consider displaying error next to each input field using CHtml::error() function.

thank you for your help and patience :) great work.