I have a model (Category) that actsAs a Tree. User and Category has a HABTM relationship. In the categories_user table, I have category_id, user_id, and skill. The "skill" field is intended to be a 1-5 integer representation of how skilled that user is at that category.

My problem arises at the view where the user edits his skills. I can't figure out how to create the form view code. I set the Tree Helper to use this code for each node of the tree: $options = array('0'=>'0', '1'=>'1', '2'=>'2', '3'=>'3', '4'=>'4', '5'=>'5');
   if(isset($data['User']['0']['CategoriesUser']['skill']))
{echo $form->input('CategoriesUser.skill', array('type'=>'radio', 'options'=>$options, 'default'=>$data['User']['0']['CategoriesUser']['skill']));}
   else
{echo $form->input('CategoriesUser.skill', array('type'=>'radio', 'options'=>$options, 'default'=>'0'));}

It generates this html code:
<div class="input radio"><fieldset><legend>Skill</legend>
<input type="radio" name="data[CategoriesUser][skill]" id="CategoriesUserSkill0" value="0" checked="checked" /><label for="CategoriesUserSkill0">0</label> <input type="radio" name="data[CategoriesUser][skill]" id="CategoriesUserSkill1" value="1" /><label for="CategoriesUserSkill1">1</label> <input type="radio" name="data[CategoriesUser][skill]" id="CategoriesUserSkill2" value="2" /><label for="CategoriesUserSkill2">2</label> <input type="radio" name="data[CategoriesUser][skill]" id="CategoriesUserSkill3" value="3" /><label for="CategoriesUserSkill3">3</label> <input type="radio" name="data[CategoriesUser][skill]" id="CategoriesUserSkill4" value="4" /><label for="CategoriesUserSkill4">4</label> <input type="radio" name="data[CategoriesUser][skill]" id="CategoriesUserSkill5" value="5" /><label for="CategoriesUserSkill5">5</label></fieldset></div>

What am I doing wrong?  Thanks in advance.

--
Jon Chin


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to