⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

Dynamic $where condition in set_relation_n_n

set_relation_n_n $where set_relation dependent drop down multiselect

  • Please log in to reply
2 replies to this topic

#1 larasmith


    Advanced Member

  • Members
  • PipPipPip
  • 199 posts

Posted 14 August 2014 - 03:21 PM

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">
				$("#field-tos_prog_id").change(function() {
					alert("Prog ID selected");	// xxx				
					function (result){
						$("#Function_field_box").load(" #field-Functions");
		' ;	

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":

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!  :)


#2 ryuusoultaker



  • Members
  • Pip
  • 5 posts

Posted 10 September 2014 - 03:38 AM

I kinda need to solve this situation too, i need exact dynamic $where condition like you do there..can some one help us with some explanation >,<

#3 larasmith


    Advanced Member

  • Members
  • PipPipPip
  • 199 posts

Posted 11 September 2014 - 02:13 AM

Hello there ryuusoultaker!


The Dynamic $where condition in set_relation_n_n is NOT POSSIBLE because it is assigned before the creation of the crud, but i created a work around to do that... please check this out:



Happy GCng!  :D  :ph34r:

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users