wiki:TracFormsPlugin/Expert

Another TracFormsPlugin Tutorial

For basic information see the beginners part.

Multiple forms per resource

TracForms has a way to allow multiple forms within a parent resource (ticket description or wiki page): the subcontext. Using multiple unique subcontext IDs you can define a virtually unlimited number of independent forms per parent resource. Add the subcontext command with an argument into each form header like this:

{{{
#!TracForm
#!subcontext different_form

... field definitions ...

}}}

Here we set subcontext to the ID 'different_form'. This hint is used by the form markup parser/processor to find saved field values and to know where to put field update information for this form. You'll notice, if you failed to comply with this demand for distinct form IDs: Each update of one form will reset other form fields within the same (unset) subcontext. No surprise, not being distinguishable they behave like one form with ever changing values.

Debug print

There is a debug operation to reveal any value of the corresponding TracForm environment. Append a criteria expression to filter the list of 'key = value' pairs. This means that '*' will show everything.

{{{
#!TracForm
choose combinations
|| ||a||b||c||
||1||[tf:check1a]||[tf:check1b]||[tf:check1c]||
||2||[tf:check2a]||[tf:check2b]||[tf:check2c]||
||3||[tf:check3a]||[tf:check3b]||[tf:check3c]||

[tf.env_debug:]
}}}

The rendered result then becomes:

env_debug application example

Note: For versions before [10146], including TracForms 0.3, the argument is mandatory, in contrast to what the syntax docs suggest.

Last modified 6 years ago Last modified on Aug 10, 2018, 6:15:51 PM

Attachments (1)

Download all attachments as: .zip