| 1 | = Custom Ticket Fields = |
| 2 | Trac supports adding custom, user-defined fields to the ticket module. Using custom fields, you can add typed, site-specific properties to tickets. |
| 3 | |
| 4 | '''Note: In Trac 0.8, this feature is still experimental.''' |
| 5 | |
| 6 | == Configuration == |
| 7 | Configuring custom ticket fields is done in the TracIni config file. |
| 8 | |
| 9 | All field definitions should be under a section named '''{{{[ticket-custom]}}}''' in the ini-file. |
| 10 | |
| 11 | The syntax of each field definition is: |
| 12 | {{{ |
| 13 | FIELD_NAME = TYPE |
| 14 | (FIELD_NAME.OPTION = VALUE) |
| 15 | ... |
| 16 | }}} |
| 17 | The example below should help to explain the syntax. |
| 18 | |
| 19 | === Available Field Types and Options === |
| 20 | * '''text''': A simple (one line) text field. |
| 21 | * label: Descriptive label. |
| 22 | * value: Default value. |
| 23 | * order: Sort order placement. (Determines relative placement in forms.) |
| 24 | * '''checkbox''': A boolean value check box. |
| 25 | * label: Descriptive label. |
| 26 | * value: Default value (0 or 1). |
| 27 | * order: Sort order placement. |
| 28 | * '''select''': Drop-down select box. Uses a list of values. |
| 29 | * options: List of values, separated by '''|''' (vertical pipe). |
| 30 | * value: Default value (Item #, starting at 0). |
| 31 | * order: Sort order placement. |
| 32 | * '''radio''': Radio buttons. Essentially the same as '''select'''. |
| 33 | * label: Descriptive label. |
| 34 | * options: List of values, separated by '''|''' (vertical pipe). |
| 35 | * value: Default value (Item #, starting at 0). |
| 36 | * order: Sort order placement. |
| 37 | * '''textarea''': Multi-line text area. |
| 38 | * label: Descriptive label. |
| 39 | * value: Default text. |
| 40 | * cols: Width in columns. |
| 41 | * rows: Height in lines. |
| 42 | * order: Sort order placement. |
| 43 | |
| 44 | === Sample Config === |
| 45 | {{{ |
| 46 | [ticket-custom] |
| 47 | |
| 48 | test_one = text |
| 49 | test_one.label = Just a text box |
| 50 | |
| 51 | test_two = text |
| 52 | test_two.label = Another text-box |
| 53 | test_two.value = Just a default value |
| 54 | |
| 55 | test_three = checkbox |
| 56 | test_three.label = Some checkbox |
| 57 | test_three.value = 1 |
| 58 | |
| 59 | test_four = select |
| 60 | test_four.label = My selectbox |
| 61 | test_four.options = one|two|third option|four |
| 62 | test_four.value = 2 |
| 63 | |
| 64 | test_five = radio |
| 65 | test_five.label = Radio buttons are fun |
| 66 | test_five.options = uno|dos|tres|cuatro|cinco |
| 67 | test_five.value = 1 |
| 68 | |
| 69 | test_six = textarea |
| 70 | test_six.label = This is a large textarea |
| 71 | test_six.value = Default text |
| 72 | test_six.cols = 60 |
| 73 | test_six.rows = 30 |
| 74 | }}} |
| 75 | |
| 76 | === Notes === |
| 77 | Do not insert space characters between '{{{|}}}'-separated option values for ''radio'' and ''select'' fields. |
| 78 | * ok: {{{FIELD_NAME.options = un|deux|trois}}} |
| 79 | * invalid: {{{FIELD_NAME.options = un | deux | trois}}} |
| 80 | |
| 81 | ---- |
| 82 | See also: TracTickets, TracIni, TracIniReportCustomFieldSample |