I have to questions. What's for the $category variable in Yii::t method
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.
$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.
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.
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
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.