Hello to all!
I hope that all is well. Sir web-johny suggested that I post this here. I'm desperately needing your help to create a "Dynamic $where condition in set_relation_n_n". To give you a better view of what I am trying to create here is an image of it:
Currently here's my code: (In the Controller this is a callback)
function tos_CBae_selFunc() { return ' <script type="text/javascript"> $(document).ready(function(){ $("#secret_field_box").hide(); $("#field-tos_prog_id").change(function() { alert("Prog ID selected"); // xxx $.get("/lara/merge/GetDrop",{drop:this.value}, function (result){ $("#Function_field_box").load(" #field-Functions"); }) }) }) </script> ' ; }
Also in the controller: (this is the one that generates the set_relation_n_n for the field: functions)
$where = array('funct_prog_id'=> $_SESSION['dropval']); $crud->set_relation_n_n('Functions', 'tbltos_funct', 'tblfunction', 'tos_id', 'funct_id', "{funct_Name}-{funct_prog_id}", 'priority',$where);
Here's the code in the "GetDrop.php":
<?php session_start(); class GetDrop extends MY_Controller { public function index() { $_SESSION['dropval'] = $_GET['drop']; } } ?>
The current output is obtained only if a page reload is done... which is not applicable to the output that I need. What I need is the auto loading of the needed values upon selecting a value from the program field.
Please help me to create this one or if there are any other better approach to this please suggest. I've done my reasearch and tried other methods but still cannot make this work. Sorry to disturb but I really need your help. :rolleyes:
Thank you very much! :)