在$ form-> input()数组中查询 [英] querying inside $form->input() array

查看:48
本文介绍了在$ form-> input()数组中查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

如何查询内部选项以从数据库中检索对应于此字段的选项。 b就像是通过$ r ['Attribute'] ['id']
发送其attribute_id并获取该属性的对应选择一样。.
我已经在Ajax上尝试过
like

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

return i.choice;});

它向我返回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....

推荐答案

您不应该这样做。在控制器中完成并将其传递到视图文件。

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

这篇关于在$ form-> input()数组中查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆