0
votes

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....

1

1 Answers

2
votes

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