Jump to content


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

larasmith

    Advanced Member

  • Members
  • PipPipPip
  • 171 posts
  • LocationPhilippines

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:

 

tanong.png

 

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

 



#2 ryuusoultaker

ryuusoultaker

    Newbie

  • 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

larasmith

    Advanced Member

  • Members
  • PipPipPip
  • 171 posts
  • LocationPhilippines

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:

http://www.grocerycr...th-multiselect/

 

Happy GCng!  :D  :ph34r:







Also tagged with one or more of these keywords: set_relation_n_n, $where, set_relation, dependent, drop down, multiselect

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users