Hi, I have a wierd problem which I am not able to figure out.
I have a form like this:
<div class="row">
<strong>Name</strong>
<input style="width: 100%;" value="" name="CategoriesForm[category_description][en][name]" id="CategoriesForm_category_description_en_name" type="text"> </div>
<div class="row">
<strong>Description</strong>
<textarea style="width: 100%;" rows="4" value="" name="CategoriesForm[category_description][en][description]" id="CategoriesForm_category_description_en_description"></textarea>
</div>
<div class="row">
<strong>Title</strong>
<input style="width: 100%;" value="" name="CategoriesForm[category_description][en][title]" id="CategoriesForm_category_description_en_title" type="text"> </div>
<div class="row">
<strong>META Description</strong>
<textarea style="width: 100%;" rows="4" value="" name="CategoriesForm[category_description][en][meta_description]" id="CategoriesForm_category_description_en_meta_description"></textarea>
</div>
<div class="row">
<strong>Alias (SEF URL)</strong>
<input style="width: 100%;" value="" name="CategoriesForm[category_description][en][sef_url]" id="CategoriesForm_category_description_en_sef_url" type="text">
</div>
My problem is when posting to the controller, I assign the $_POST[‘CategoriesForm’] to the $model->attributes but here is what I get when I try to output the results:
// using the default layout 'protected/views/layouts/main.php'
$model=new CategoriesForm;
// collect user input data
if(isset($_POST['CategoriesForm']))
{
// pass form input values to the LoginForm class
$model->attributes=$_POST['CategoriesForm'];
echo '<pre>';
print_r($_POST['CategoriesForm']);
echo '</pre>';
echo '<pre>';
print_r($model->attributes);
echo '</pre>';
Yii::app()->end();
}
Array
(
[id] =>
[category_description] => Array
(
[en] => Array
(
[name] => aaaaaaaa
[description] => aaaaaaaaa
[title] => aaaaaaaaaa
[meta_description] => aaaaaaaaaa
[sef_url] => aaaaaaaaaaaaa
)
[fr] => Array
(
[name] =>
[description] =>
[title] =>
[meta_description] =>
[sef_url] =>
)
)
)
Array
(
[id] =>
[category_description] => Array
(
)
)
I tried the same test with my login for and it works.
Anyone know why this happens?
Thanks!