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

MD. ABDUL Halim
  • 712
  • 3
  • 11
  • 32
  • When you select an ID No. from the dropdown, you want to populate the remaining fields? If you want that, you need to use Javascript. A good library for using Javascript is jQuery for example. – Philipp Jan 11 '13 at 17:57

2 Answers2

2

You can use AJAX. If you use jquery, you can do something like:

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

Basically, when field-ID_No (the select/combobox) changed, the program will send a request to the server (for example: get_name_of_id/1). Assuming, you have "get_name_of_id" function in the controller that echo-ing a name based on given id, you will get the name as response. (Sorry if it sounds complicated). And then, the value of field-Name should be changed with that echoed name.

For more information about AJAX and JQuery, you can read https://stackoverflow.com/a/5004276/755319

Community
  • 1
  • 1
goFrendiAsgard
  • 4,016
  • 8
  • 38
  • 64
0

I have done this what you want, it is really simple complete tutorial is on following link http://www.grocerycrud.com/forums/topic/1087-updated-24112012-dependent-dropdown-library/

hope you will find it helpful

Tousif
  • 301
  • 3
  • 11