Extension:TemplateFormEditor/Example

=Example=

= Defining a Template which uses the Form-Editor =

First condition: your template must contain at least one parameter. The parameter can be named or unnamed.

Second condition: your template must define the type of its parameters

Here is a simple example: The sourcecode of the page "Template:Bugreport"

= Using a Template =

After you have created the template shown above you can use it:


 * Create a new article e.g. "Bugreport 0815"
 * the default editor appears.
 * write "" into the textbox and push the button "show preview"
 * Now the form-editor is shown.        -       the following screenshot shows this example on a german wiki

screenshot of the form generated by this extension

Up to now it only makes sens to use the Form-Editor provided by this extension with articles that only contain one template

= Combinations with other extensions =

Defining parameter types in the template definition page has two disadvantage:
 * e.g. defining a "oneof" or "someof" element with 10 elements you can not define which of these elements are shown at which page
 * when new options are needed you need to edit the definition page.

Using the Extension:RegexParserFunctions and Extension:DynamicPageList inside the type definition you can define a dynamically calculated set of allowed values: E.g. the following definition defines that allowed values are the Titles of all Pages of category "MyCategory" *page:someof "A Page" // All currently existing pages of category MyCategory are listed.

The following defines that parameter a and b are only available on a pages containing "AB Page" in its page name:

* parameter:oneof ( c, d )