Loading...
 

Tracker Field Rules

New in Tiki 21.0 - this provides an easy way to make fields in a tracker form show or hide (or be required or not) depending on the settings of other fields in the form.

Some brief instructions:

  • Go to the Features Control Panel and enable "Enable Vue.js" and "Tracker Field Rules" in the Interface tab
  • Go to the field admin page for a tracker
    Screenshot 2020 03 07 At 11.20.16
  • Click on a field (try a checkbox for instance)
  • Go to the "Rules" accordion section
  • Pick true or false for the "is checked" condition
  • Choose a field from the actions menu, and then an action (e.g. show)
  • Choose a field from the else menu, and then an action (e.g. hide)
    Screenshot 2020 03 07 At 11.20.57
    Screenshot 2020 03 07 At 11.21.11
  • Save the field
  • Then go to edit an item in that tracker and check and uncheck the checkbox
    create a new item to try this out

Notes on Field Types

  • Category Fields
    • These have the options is empty, contains and doesn't contain like other "collection" fields, but for categories you need to enter the category Id's, not the names.
  • ShowTikiOrg and Ratings Fields
    • Currently (v 21.1) not working as they aren't really normal input fields - possibly will be fixed in future versions.


Note, this is an extremely new feature and should be considered rather fragile as of 21.0 (early 2020). Future changes in the code may mean you need to remake your rules after an upgrade.

Using Field Rules in a Wiki Page (with Plugin Tracker)

In PluginTracker there are two new parameters, rules and rulesparent, rules is a y/n switch so set that to y, but rulesparent is a little trickier on a customised tracker plugin form (leave it empty if you are not using a Pretty Tracker form in your page.

Assuming you are, you need to tell the rules which element is the parent container element for the field you are acting on (say, to show or hide it).

  • First do "inspect element" (this is in Firefox but more browsers do this)
    Parent Selector 1
  • Move the rightmost panels out of the way so you can see the document structure
    Parent Selector 2
  • Hover over the element you've just inspected and it will light up in the page (here in purple and blue)
    Parent Selector 3
  • Then move up the document structure until you find the whole row you would want to show or hide
    Parent Selector 4


This form is a simple wiki table, so the container element is the tr (table row) which contains the input and the label, so your selector will be simply tr, but to make sure it doesn't get confused if the table's inside another one use tr:first, so your markup should be:

Copy to clipboard
{tracker trackerId="42" wiki="tracker test tpl" rules="y" rulesparent="tr:first"}




Related:



Alias names for this page:
Tracker Rules | TrackerRules | TrackerFieldRules | Tracker Rule | TrackerRule | TrackerFieldRule | Rule | Rules

List Slides