2009-09-08 6 views
0

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

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

Comment interroger les options à l'intérieur pour récupérer les options de la base de données pour ce correspondant champs .. comme envoyer son attribute_id par $ r [' attribut '] [' id '] et aller chercher les choix cooresponding pour cet attribut .. Je l'ai essayé avec Ajax poster comme

       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;});

Et il me renvoie les choix dans le i.choice .. mais je ne sais pas comment placer ce à l'intérieur du tableau d'options ... S'il vous plaît me suggérer ....

+0

dupliquer: http://stackoverflow.com/questions/1393164/fix-the-options-in-cakephp-form-field-of-type-radio-button – deizel

Répondre

2

vous n'êtes pas censé faites cela en vue. faites-le dans le contrôleur et passez-le au fichier de vue.

+0

salut j'ai utilisé un post ajax et je suis allé chercher pour cet identifiant d'attribut correspondant, mais ne sais pas comment y remédier – useranon