2009-09-08 56 views
0

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

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

如何查詢裏面選擇,從數據庫中檢索選項此對應的字段.. 像由$ R [發送其attribute_id」屬性「] [」身份證'] 和打水該屬性cooresponding的選擇.. 我試了它與阿賈克斯後 像

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

,並返回我的選擇在i.choice .. 但我不知道如何把這個選項數組內... 請建議我....

+0

重複:http://stackoverflow.com/questions/1393164/fix-the-options-in-cakephp-form-field-of-type-radio-button – deizel 2009-09-10 13:04:04

回答

2

你不應該這樣做的目的。在控制器中執行並將其傳遞給視圖文件。

+0

您好我已經使用了一個AJAX帖子,並提出了選擇爲相應的屬性ID,但不知道如何解決它的選項 – useranon 2009-09-09 04:30:33

相關問題