0

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 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.