Version 4 (modified by Reinhard Wobst, 6 years ago) (diff)


Conditionally display fields based on ticket type


With the help of this Trac plugin you can hide or show fields when creating or viewing a ticket, depending on the ticket type. Only the presentation changes, not the contents of the ticket.

CondFieldsGenshiPlugin is derived from the CondFieldsPlugin (Dynamic fields by ticket type), but it is completely based on Genshi now instead of using Javascript. Moreover, you can select whether selected fields are hidden or shown by default.

This plugin is standalone; the patch blackmagic-conditionalfields.patch in [1] did not match with newer releases of Trac 0.11.

Some problems reported about the more powerful DynamicFieldsPlugin (bad scaling for many fields, malfunction if fields are internally sorted, clearing value of hidden fields) should not occur here.

It should be easy to extend this plugin, e.g. for dependence on other parameters than ticket type.

The plugin was tested under Trac 0.12 but should work under Trac 0.11, too.

Bugs/Feature Requests

Existing bugs and feature requests for CondFieldsGenshiPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:condfieldsgenshiplugin here].


You can check out CondFieldsGenshiPlugin from here using Subversion, or browse the source with Trac.


First, configure trac.ini as in this example:

condfieldsgenshi.* = enabled
tweaks = field1, field2
default = disable
field1.type_cond = defect
field2.type_cond = task


Now field1 will be shown only if the ticket type is defect, field2 only if the ticket type is task.

The entry
default = disable
means that the field listed under tweaks are NOT shown by default. The default value is default = enable.

To disable/enable a field independent of the ticket type, simply write a line like

field1.type_cond = None

(supposed there is no None type :-).

When you change the ticket type, you must type preview resp. submit before you can see the effect of of condfieldsgenshi.

Bug fix done for type field

When the ticket type is given as an URL parameter only:


and the ticket type field is disabled, this plugin works nevertheless (in contrast to the Dynamic fields by ticket type plugin, cf. [1]).

The type field label is extended by (Fixed) in this case now.

Recent Changes

17121 by rjollos on 2018-04-13 09:59:38

CondFieldsGenshiPlugin 0.3dev: Fix multiple defects

  • Ticket type selection did not work for previews
  • Use empty value rather than None to indicate "all values"
  • Use enabled and disabled values for field default
13364 by rjollos on 2013-08-26 12:22:32
Moved license text to COPYING file. Fixes #11282.
12533 by Reinhard on 2013-01-14 16:01:56
update to version 0.2: pattern negation included


Author: Reinhard
Maintainer: Reinhard

Attachments (1)

Download all attachments as: .zip