Now, when I submit the form I see the values in the POST request. However, when the form submit fails then I can not get the values back into the input fields. Printing the model it shows that there are no values for $test; - is this because $test is an array in the form?
Any pointers in the right direction would be helpful
What I want to achieve is:
If the validation fails put the entered values back into the appropriate input text fields.
This chapter of the Yii guide doesn’t answer the question. Even if the title is “Collecting Tabular Input”, in fact it only deals with multiple models instances. It’s very different from having a model attribute whose value is an array.
If you want the fields to display their content and error messages, the Yii way is to use CActiveForm::textField() wich is a wrapper on CForm::activeTextField(). Unfortunately, these methods can’t deal with values of type array. For instance, they make a single call to CHtml::activeInputField() which prints a single input field.
I believe you have to handle the display with custom PHP code that adds error classes and inserts the values of the properties, etc.