TracTicketsCustomFields - mattbichay/test GitHub Wiki

Table of Contents

Custom Ticket Fields

Trac supports adding custom, user-defined fields to the ticket module. Using custom fields, you can add typed, site-specific properties to tickets.

Configuration

Configuring custom ticket fields is done in the [wiki:TracIni] file. All field definitions should be under a section named `[ticket-custom]`.

The syntax of each field definition is:

The example below should help to explain the syntax.

Available Field Types and Options

 * '''text''': A simple (one line) text field.
   * label: Descriptive label.
   * value: Default value.
   * order: Sort order placement. (Determines relative placement in forms.)
 * '''checkbox''': A boolean value check box.
   * label: Descriptive label.
   * value: Default value (0 or 1).
   * order: Sort order placement.
 * '''select''': Drop-down select box. Uses a list of values.
   * label: Descriptive label.
   * options: List of values, separated by '''|''' (vertical pipe).
   * value: Default value (Item #, starting at 0).
   * order: Sort order placement.
 * '''radio''': Radio buttons. Essentially the same as '''select'''.
   * label: Descriptive label.
   * options: List of values, separated by '''|''' (vertical pipe).
   * value: Default value (Item #, starting at 0).
   * order: Sort order placement.
 * '''textarea''': Multi-line text area.
   * label: Descriptive label.
   * value: Default text.
   * cols: Width in columns.
   * rows: Height in lines.
   * order: Sort order placement.

Sample Config

Note: To make entering an option for a `select` type field optional, specify a leading `|` in the `fieldname.options` option.

Reports Involving Custom Fields

The SQL required for TracReports to include custom ticket fields is relatively hard to get right. You need a `JOIN` with the `ticket_custom` field for every custom field that should be involved.

The following example includes a custom ticket field named `progress` in the report:

Note in particular the `LEFT OUTER JOIN` statement here.


See also: TracTickets, TracIni
⚠️ **GitHub.com Fallback** ⚠️