Working With MediaWiki
like Cologne Blue, contain hard-coded links to "Edit this page", which can’t be removed or renamed by the Semantic Forms code.
Linking to forms
How do you get users to forms to create the pages in the first place? The standard way is via the #forminput parser function call, which displays a single input for users to enter the name of a page; if they enter such a name and click the button, they are sent to a form to create that page — unless a page with that name already exists, in which case they are sent to a form for editing the existing page. This is what is known as the "two-step process". The reason for the initial step, of having the user first enter the page name, is to ensure that users don’t accidentally overwrite existing pages. This process is so standard that it is built into the default forms produced by Semantic Forms’ Special:CreateForm and Special:CreateClass helper pages: any form-definition page created by Semantic Forms includes, at the top, a call to #forminput, so that users who go to that form page can automatically start to use the form.
However, it’s also possible to skip the first step, of entering the page name — that’s what you should do if the form contains a formula for setting the page name based on the user input. That’s the "one-step process", and it uses the parser function #formlink instead of #forminput.
Query forms, which use Special:RunQuery, have their own linking method, using the parser function #queryformlink — we’ll get to those here .
The two-step process
The two-step process, i.e. the standard way to get users to forms, is done using the #forminput parser function.
Using #forminput
Here is the syntax of the #forminput parser function:
{{#forminput:form= |size= |default value= |button text= |query string= | query string parameters |autocomplete on category= |autocomplete on namespace= |remote autocompletion |popup}}
All arguments are optional. An explanation of the parameters:
form=
- the name of the SF form to be used; if it is left empty, a dropdown will appear, letting the user choose among all existing forms.
size=
- the size of the text input (default is 25).
default value=
- the starting value of the input (default is blank).
button text=
- the text that will appear on the "submit" button (default is "Create or edit page").
query string=
- the set of values that you want passed in through the query string to the form. It should look like a typical URL query string; an example would be “
query string=namespace=User&User[Is_employee]=yes
”. Additionally, any query string values can be passed directly in as parameters — so the values above could instead be passed in as “
|namespace=User|User[Is_employee]=yes
”.
autocomplete on category=
- adds autocompletion to the input, using the names of all pages in a specific category.
autocomplete on namespace=
- adds autocompletion to the input, using the names of all pages in a specific namespace (only one of these two can be used).
remote autocompletion
- specifies that autocompletion values should be retrieved dynamically from the server, instead of directly from a list of values hidden in the page’s HTML (thus allowing many more values).
popup
- opens the form in a popup window.
Adding pages of a specific namespace
You can have a page-input form create pages within a specific namespace (like ’User:’) by default, without forcing users to type in that namespace every time. To do that, add “
namespace= namespace-name
” to the
query string=
parameter.
Adding subpages
In MediaWiki, you can create subpages by including a slash in the page name (see here ). To have the page that’s added automatically be a subpage, you can add a value for “
super_page=
” in the query string. To make it a subpage of the current page, you can set this value to “
super_page={{PAGENAME}}
”. This will prepend a “ current-page-name/ ” onto the beginning of the page name that the user types in.
The one-step process
You can have the name of the page created by the form be set automatically, by adding a "page name" parameter within the form definition’s "info" tag. There are two types of "variables" one can include in the value for this parameter:
< TemplateName [ FieldName ]>
- gets replaced with the value for the specified field FieldName in the specified template TemplateName .
- by default, gets replaced by the lowest number for which the
Weitere Kostenlose Bücher