tags:

views:

64

answers:

1

Hi,

             echo $form->input('field', array(
      'type' => 'radio','legend'=>$r['Attribute']['label'],

      'separator' => '--separator--',
      'options' => array() 
  ));

How to query inside options to retrieve the options from the database for this corresponding Field.. like sending its attribute_id by $r['Attribute']['id'] and fetching the cooresponding choices for that attribute.. I have tried it with Ajax post like

                             var ht = $.ajax({
                                              type: "GET",
                                              url: "http://localhost/FormBuilder/index.php/forms/viewChoices/"+attribute_id,
                                                                 async: false
                                                    }).responseText;


               var myObject = eval('(' + ht + ')');


var data = myObject;var j=0;
 $.map(data.choices, function(i){ j++; alert(i.choice);

return i.choice;});

And it returns me the choices in the i.choice.. but i dont know how to place this inside the options array... Please suggest me....

+2  A: 

you are not supposed to do that in view. do it in the controller and pass it to the view file.

Funky Dude
hi i have used an ajax post and fetched that choices for that corresponding Attribute id but dont know how to fix it options
Aruna