arraysize: 0


How to use Page Forms with #cr-parse-request

It is possible to use the parser function together with an embedded version of a (query) form from the Page Forms extension ({{Special:RunQuery/FormNameHere}}). Because Page Forms was not designed for third purposes in this way, there are a couple of additional instructions to follow to make things work.
Use Page Forms with a template that has no content (between includeonly tags) and optionally, uses a concise name. Here is why:
  • Page Forms requires a template for the query results. Because we want to bypass standard behaviour, we need to prevent this template from returning any query results. This is only an issue when the updateurl parameter of #cr-parse-request is set to true and the page is loaded with URL search parameters in place. All you need to do is provide Page Forms with an empty template.
  • Data submitted through Page Forms take the form templatename[fieldname]. Accordingly, the variables in our parser function would take the form {{{$templatename[fieldname]|}}}. Nothing to worry about, but a short template name like Q would make for shorter variable names.

Page Forms may also replace the visible page title with Special:RunQuery, even if you set query title in the info tag to a different value. This appears to be a minor bug with the Page Forms extension itself, or at least in the release version you are using.

Example

The code:

<div class="row">
<div class="col-md-4">{{Special:RunQuery/Qpub standalone}}</div>
<div class="col-md-8">
{{#cr-parse-request:<nowiki>{{Qpub
|Phrase={{{$Q[Phrase]|}}}
|Contr={{{$Q[Contr]|}}}
|Type={{{$Q[Type]|}}}
|Year1={{{$Q[Year1]|}}}
|Year2={{{$Q[Year2]|}}}
|Periodical={{{$Q[Periodical]|}}}
|Sort={{{$Q[Sort]|}}}
|Outro template=Qpub pagination
|offset={{{$offset|0}}}
|limit={{{$limit|50}}}
}}</nowiki>
|trigger=onsubmit
|triggerid=pfForm
|class=d-block
|paginationid=cr-pagination
|updateurl=true
}}
</div>
</div>

Result: