[TYPO3-formidable] denpendsOn a value

Antoine Rochefort antoine at dev-freelance.fr
Tue Nov 30 00:35:50 CET 2010


Hello,
You may use a dependancy :
http://formidable.typo3.ug/tutorials/dependancies-the-clean-way.html

or do somehting with a sandbox like bellow (successfully texted) :



<sandbox>
<userobj>
       <php><![CDATA[

		var $my_key = "";

		function getDynItem() {
			switch($this->my_key) {
	case "1" : $res = 
array(array("value"=>"1","caption"=>"Bob"),array("value"=>"2","caption"=>"Bill")); 
break;
	case "2" : $res = 
array(array("value"=>"1","caption"=>"Arthur"),array("value"=>"2","caption"=>"Aes 
Sedai")); break;
	default : $res = array();
			}

			return $res;
		}

       ]]></php>
</userobj>
</sandbox>


<renderlet:LISTBOX  name="list_box_1" label="list_box_1"  >
<data>
	<items>
		<item caption="chiens" value="1" />
		<item caption="chats" value="2" />
	</items>
</data>
<onChange runat="ajax" params="list_box_1" when="before-init-renderlets" >
	<userobj>
		<php><![CDATA[

			$aParams = func_get_arg(1);

			// if you have several value selected ...use a more complex algo

			$this->oSandBox->my_key = $aParams["list_box_1"];
			$aItems = $this->aORenderlets["list_box_2"]->_getItems();
			return $this->aORenderlets["list_box_2"]->majixReplaceData($aItems);

		]]></php>
	</userobj>
</onChange>
</renderlet:LISTBOX>

<renderlet:LISTBOX name="list_box_2"  label="list_box_2" >		
	<data>
		<userobj>
			<php><![CDATA[
			
			// return array of items = couples of (value="4545", 
caption="label_item")
			return $this->oSandBox->getDynItem();
				
			]]></php>
		</userobj>
	</data>
</renderlet:LISTBOX>


good luck

Antoine

Le 29/11/2010 15:45, Genc Ural a écrit :
> Hello,
>
>
>
> I try to get dependencies between two(or three) Listboxes.
>
>
>
> That means:
>
>
>
> If I select in Listbox A the value "Test1" show me the Listbox B
>
>
>
> Or
>
>
>
> If I select on Listbox A the value "Test2" show me the Listbox B and
> Listbox C
>
>
>
>
>
> Can you help me how can I solve this.
>
>
>
> Thanks and best regards
>
> Ural Genc
>
> ************************************************************************************************************************
> Besuchen Sie uns:   www.baumer.com/motion
>
> ************************************************************************************************************************
>
> Geschaftsfuhrer: Joachim Acker . Dr. Michael Schneider
> Sitz der Gesellschaft: Villingen-Schwenningen
> Amtsgericht Freiburg: HRA 601898  Ust. ID: DE 142983906
> Personlich haftende Gesellschafterin: IVO Verwaltungs-GmbH . Villingen-Schwenningen . HRB 602261
>
> Disclaimer
> This message might contain confidential and privileged information and is intended only for the individuals or entities to which it is adressed. It should not be copied, reviewed, retransmitted, disseminated or otherwise used by persons or entities other than the intended recipient. If this message was received in error, please contact the sender and delete the material from your computer system(s).
>
> Receipt of this message does neither generate any right of further use nor entitles the recipient to file and/or obtain any intellectual property rights based thereon.



More information about the TYPO3-project-formidable mailing list