2

In Grocery Crud and Codeigniter , Basically i want to show data from one table(such as a_tbl) when select data or id_no(id_no will get from a_tbl) in dropdown then Name and current posting data will take in input field from table(such as a_tbl) , Then Designation, Dept and Section will take in input field from three different table (such as desg_tbl, dept_tbl, sect_tbl).

enter image description here

How can i solve it , Please any help me

4

2 回答 2

2

您可以使用 AJAX。如果您使用 jquery,您可以执行以下操作:

$("#field-ID_No").change(function(){
   $.ajax({
      'url':'your_controller/get_name_of_id/'+$("#field-ID_No").val(),
      'success':function(response){
         $("#field-Name").value(response);
      }
   });
});

基本上,当field-ID_No(选择/组合框)改变时,程序会向服务器发送一个请求(例如:get_name_of_id/1)。假设,您在控制器中有“get_name_of_id”函数,它根据给定的 id 回显名称,您将获得名称作为响应。(对不起,如果这听起来很复杂)。然后,应该使用该回显名称更改 field-Name 的值。

有关 AJAX 和 JQuery 的更多信息,您可以阅读https://stackoverflow.com/a/5004276/755319

于 2013-01-14T05:31:18.253 回答
0

我已经完成了你想要的,它真的很简单,完整的教程在下面的链接 http://www.grocerycrud.com/forums/topic/1087-updated-24112012-dependent-dropdown-library/

希望你会发现它有帮助

于 2013-01-23T05:29:04.213 回答