wiki:TracFormsPlugin/Expert

Version 3 (modified by Steffen Hoffmann, 13 years ago) (diff)

add debug operation example

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 for filtering the list of 'key = value' pairs. I.e. '*' will show everything.

{{{
#!TracForm

... field definitions ...

[tf.env_debug:]

... field definitions ...

}}}

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

Attachments (1)

Download all attachments as: .zip