History: Dynamic items list
Source of version: 18
Copy to clipboard
! Dynamic items list !! Basic documentation Function: Dynamically updates a selection list based on linked data from another tracker. Usage: trackerId,filterFieldIdThere,filterFieldIdHere,listFieldIdThere,statusThere Description: || trackerId | is the ID of the tracker to link with; filterFieldIdThere | is the field you want to link with in that tracker; filterFieldIdHere | is the field you want to link with in the current tracker; listFieldIdThere | is the field ID you wish to pull the selection list from, based on the value selected in fiterFieldIdHere matching field(s) in filterFieldIdThere; statusThere | restricts values appearing in the list to those coming from records in the other tracker that meet specified statuses of ~np~[o|p|c]~/np~ or in combination (op, opc); || multiple options must appear in the order specified, separated by commas. to be tested filterFieldHere can be an item link, a user selector, a group selector, a country selector, a dynamic list !! Tutorial With Tiki's ((trackers)), you can create dynamic forms, in which field options change automatically, depending on other selections. In this tutorial, you will create a dynamic tracker that users will complete to enter their operating system and version number. Depending on the operating system that they choose (Windows or Solaris), different version options will appear. You will actually need to build two trackers: an "internal" tracker to hold the dynamic options, and an "external" tracker from which the user will make their selections. !!!Step 1: Build the "internal" tracker for the selectable options #Create a new tracker. +In this example, since the selectable options are for an "operating system", we will name the tracker __Operating System__. +Record the ID number for this tracker. We'll refer to this tracker as the __''Option Tracker ID''__. +In this example, the ID is __~~red:6~~__. +{img src=img/wiki_up/dynamic_tracker_1.png} #Create a field with the name __OS__, of type __drop down__, with the options __Windows,Solaris__. +Record the ID number for this field. We'll refer to this field as the __''Option Tracker Choices ID''__. In this example, the ID is __~~purple:8~~__. #Create a field with the name __Version__ of type __text__ for this tracker. +Record the ID number for this field. We'll refer to this field as the __''Option Tracker Versions ID''__. In this example, the ID is __~~green:9~~__. +{img src=img/wiki_up/dynamic_tracker_2.png} !!!Step 2: Populate the "internal" tracker. Now that you've built the tracker to hold the options, you need to populate the tracker with the valid choices. #From the Trackers listing page, click the __Option Tracker__ tracker that you just created. #Click __Insert new Item__. #Populate the valid OS versions. +In the OS field, select __Windows__. +In the Version field, type __Vista__. +{img src=img/wiki_up/dynamic_tracker_3.png} #Repeat these steps to enter all of the valid combinations that to allow (for example: Windows XP, Solaris 2.9, and so on. +{img src=img/wiki_up/dynamic_tracker_4.png} !!!Step 3: Create the "external" user tracker Now you need to create the actual tracker the will contain the selectable options that you defined. #Create a new tracker. +In this example, we will name the tracker __User Profile__. #Create a field with the name __Operating System__, of type __item link__ with the options: ''__Option Tracker ID__'',''__Option Tracker Choices ID__'' +You created these IDs in {ALINK(aname=Step_1_Build_the_quot_internal_quot_tracker_for_the_selectable_options)}Step 1{ALINK}. In this example, the options are: ~~red:6~~ , ~~purple:8~~. +This is the selector from which the users will select their operating system (Windows or Solaris). +Record the ID number for this field. We'll refer to this field as the __''User OS Choices ID''__. In this example, the ID is __~~orange:10~~__. #Create a field with the name __Version__, of type __dynamic items list__, with the options: ''__Option Tracker ID__'',''__Option Tracker Choices ID__'',''__User OS Choices ID__'',__Option Tracker Versions ID__ +In this example, the options are: ~~red:6~~ , ~~purple:8~~ , ~~orange:10~~ , ~~green:9~~ . #Create a field with the name __Your name__, of type __text__. +This will simply be a field for users to enter their names. +{img src=img/wiki_up/dynamic_tracker_5.png} !!!Test the tracker Now you can test the "user" tracker (named __User Profile__ in this example). #From the Trackers listing page, click the __User Profile__ tracker that you just created. #Click __Insert new Item__. +Notice that the __Version__ field is empty. #In the __Operating System__ field, select __Windows__. +Notice that the __Version__ field is now populated with the Windows options (Vista, XP, and 95). +{img src=img/wiki_up/dynamic_tracker_6.png} #Change the __Operating System__ field to __Solaris__. +Notice that the __Version__ field is now populated with the Solaris options (2.9 and 2.10). +{img src=img/wiki_up/dynamic_tracker_7.png} !!Final notes * [http://dev.tikiwiki.org/tiki-view_tracker_item.php?itemId=3108&trackerId=5&show=view|Chained use of the dynamic list item type in trackers] does not work at the moment (Tiki5.0Beta1). Vote for the issue if you feel it is important. *[http://doc.tikiwiki.org/Category+Tracker+Field&structure=Documentation|Categories] might be an alternative for you. !!See also [PluginJQ#Conditional_display_of_fields|Plugin JQuery] !!Backlinks: {BACKLINKS()}{BACKLINKS} Alias names for this page: (alias(Dynamic items lists)) | (alias(Dynamic item lists)) | (alias(Dynamic item list)) | (alias(Dynamic_items_list))