Extension talk:Page Forms

Date input type struggles with fragmentary dates
Hello again. I'm still using Mediawiki 1.30.0 with the page forms extension 4.3.1 on a Synology NAS. This system is still not public. Cargo or Semantic Mediawiki is still not installed. The PHP version is still 5.6.34 and MariaDB 10.0.32 serves still as database.

Now I created a form using the combox field:. Three input field are diplayed. One for the day, the next for the month and the last for the year. If I enter a full scale date with day, month and year, all is fine. If I enter only a day or only a month and if I save the article, the input has been dumped. The template call in the article shows no Day of birth parameter. So far, so good. If I enter a year only, the articles template call shows this year at the Day of birth parameter. And if I want to edit this article by using its form, the input fields for the day and the month are blanked and the input field for the year shows the before prompted year. This is fine, too. But if I blank the day field and fill only the month and the year field, I get the month in full text, followed by the year as value at the Day of birth parameter. So far, no error. But if I edit this article now, using its form, the day is blank, as anticipated, but the month and the year field shows January 1970 at all times and not the month and date value from the template call.

Maybe the localisation is the problem? Since it is a german environement, in case of the month and year only input the month name is saved in german language. This is in accordance with the month dropdown. The month to choose from are also displayed in german language. If I change the parameters value directly without using the form from, for example, the german Februar 1950 to the english February 1950, this "english" value works.

And again many thanks for a note on my struggle with Page Forms in advance! Wgkderdicke (talk) 02:46, 2 June 2018 (UTC)


 * There's no real need to list all the things that do work... I think you could have just described the problem as "Page Forms does not parse dates correctly if they are of the form 'month-name year' when the month name is in a non-English language". Thankfully, I was able to reproduce the problem - I just checked in a fix. Sorry about that. Yaron Koren (talk) 18:50, 4 June 2018 (UTC)


 * Well, that's me. On the one hand, I've always got a knack for making it more complicated than necessary. On the other hand I try to improve my English a little bit on such occasions. So one thing gets to the other and zack, there is the litany... ;-) Thanks for the fix. Wgkderdicke (talk) 21:04, 4 June 2018 (UTC)

monolingual text and input type textarea with autocomplete
I use PF 4.3.1 and have set the form field “keywords” to autocomplete by a monolingual text property “Has keyword”: … but in the form I only get the page to be selectable. If I use a property with normal data type text, then it works as expected. See also https://phabricator.wikimedia.org/T196447. Thank you for resolving this. --Andreas P. 11:15, 5 June 2018 (UTC)

formredlink "create page" bug
Hi, I'm trying to use formredlink in a template with the "create page" option (PF 4.3.1 MW 1.29) with the code:

The template will only display properly after the page is created by the job, but since it is not created, the output is the following: MWException from line 264 of /var/www/html/lab/includes/parser/ParserOutput.php: Bad parser output text.

Backtrace:

Any clue??? Steph.
 * 1) 0 [internal function]: ParserOutput->{closure}(array)
 * 2) 1 /var/www/html/lab/includes/parser/ParserOutput.php(274): preg_replace_callback(string, Closure, string)
 * 3) 2 /var/www/html/lab/includes/OutputPage.php(1879): ParserOutput->getText
 * 4) 3 /var/www/html/lab/includes/OutputPage.php(1900): OutputPage->addParserOutputText(ParserOutput)
 * 5) 4 /var/www/html/lab/includes/page/Article.php(601): OutputPage->addParserOutput(ParserOutput)
 * 6) 5 /var/www/html/lab/includes/actions/ViewAction.php(68): Article->view
 * 7) 6 /var/www/html/lab/includes/MediaWiki.php(499): ViewAction->show
 * 8) 7 /var/www/html/lab/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
 * 9) 8 /var/www/html/lab/includes/MediaWiki.php(862): MediaWiki->performRequest
 * 10) 9 /var/www/html/lab/includes/MediaWiki.php(523): MediaWiki->main
 * 11) 10 /var/www/html/lab/index.php(43): MediaWiki->run
 * 12) 11 {main}


 * Sorry, I don't understand - where are you seeing that output? And does it show up every time you view that page(s)? Yaron Koren (talk) 01:20, 7 June 2018 (UTC)
 * Hi, the error message is the page output, it appears until the redlinked page is created by the job queue. After the redlink page is created, the page output is normal. Steph.
 * Hi Yaron, After extensive tests, I finally found what's triggers the error. And it is weird! It appears that when you have a formredlink with create page option inside a template and that the rendered page has a H1 title (I mean =Title X= ), you end up with an MWException!
 * Let   be a template that contains:

''' =FOO= foo bar, '''
 * Any call to this template in a page crashes MW parser until the target is created.
 * Remove  =FOO=, it works!!! Steph.


 * Wow! I'm glad you discovered that, because I had no idea what could be causing the error. Are you using Header Tabs or some other extension that does some processing to H1-style headers? Yaron Koren (talk) 18:24, 8 June 2018 (UTC)
 * Indeed, Headertabs is installed on this wiki, but the crash appends even without a tag in the page. I'm not aware if the extension triggers some script even when not invoked... Steph.
 * I disabled headtabs and tried again: exception is still fired. I also noted that if the title is set after the formredlink, everything works fine! Steph.
 * It was actually already known : Extension_talk:Page_Forms/Archive_September_2015... Steph.

Dynamic Section Name?
i need:
 * A form to add new sections to an existing page.
 * New section name is passed into form as a parameter (like a template parameter, with 3 curly braces)
 * New section content is entered into form by user.


 * Are you asking about having functionality like the "Add topic" tab in talk pages? If so, Page Forms unfortunately can't provide that. Yaron Koren (talk) 01:21, 7 June 2018 (UTC)

Hi, thx for reply.

Doc says: "A form allows a user to populate a pre-defined set of templates, as well as page sections"

That's what I want. Only difference is, I want to pass the section name to the form, instead of hard coding the section name.

Can the form receive parameters?

Like this: 



Or



Perhaps called with something like:


 * No - none of those will work, unfortunately. Yaron Koren (talk) 04:07, 7 June 2018 (UTC)

How to exclude Class?
Your sample form definition contains: {| class="formtable" ! Author....

If I don't want to include Class, how should that code begin? Like this? {|Author.... Johnywhy (talk) 02:54, 7 June 2018 (UTC)


 * I think it needs to be:

{| ! Author.... Yaron Koren (talk) 04:08, 7 June 2018 (UTC)

template-name in info tag vs "for template" tag?
What's difference between in info tag, and  tag?

Johnywhy (talk) 03:25, 7 June 2018 (UTC)


 * I'm not sure I understand the question. The "info" tag and the "for template" tag do different things... Yaron Koren (talk) 04:09, 7 June 2018 (UTC)

template-name is defined here- https://www.mediawiki.org/wiki/Extension:Page_Forms/Linking_to_forms#The_one-step_process

for template tag is defined here- https://www.mediawiki.org/wiki/Extension:Page_Forms/Defining_forms#'for_template'_tag

What's the difference?

Johnywhy (talk) 04:33, 7 June 2018 (UTC)


 * The template name in the "info" tag is only used to set the page name... if that helps. Yaron Koren (talk) 04:50, 7 June 2018 (UTC)

If   , then how is that different than the "page name" parameter?

Johnywhy (talk) 05:08, 7 June 2018 (UTC)


 * The "template-name" you're referring to is part of the "page name" parameter, no? Yaron Koren (talk) 13:55, 7 June 2018 (UTC)

How To Retrieve Query String Parameters?
i see some examples here of how to load query string. eg query string=namespace=User&User[Is_employee]=yes and |namespace=User|User[Is_employee]=yes

But i don't see example of syntax to retrieve the value of Query String parameters inside the form def.

Johnywhy (talk) 04:32, 7 June 2018 (UTC)


 * Query string values like the ones in those examples get automatically retrieved by the software. But in general, you could use #urlget - it won't necessary work within tags, though. Yaron Koren (talk) 13:57, 7 June 2018 (UTC)

FormStart Page Name vs Info Tag Page Name?
Special:FormStart requires user to enter name of page to edit.

How is that "name of page" different from page name in info tag? Johnywhy (talk) 1:28, 7 June 2018 (UTC)


 * It's the difference between the one-step and two-step processes for page creation, which are covered here. Yaron Koren (talk) 13:58, 7 June 2018 (UTC)

Ah, ok, so i would use one or the other, but not both, correct? Johnywhy (talk) 14:28, 7 June 2018 (UTC)


 * Usually - there could potentially be forms that have a page-name formula and usually set the page name themselves, but also sometimes get a page name manually passed in. Yaron Koren (talk) 16:17, 7 June 2018 (UTC)

Can #arraymap or #arraymaptemplate split string on pairs?
Is it possible to make a variable in template with complex value = "Key1: Value1; Key2: Value2; Key3: Value3", then using arraymap split it on pairs and pass to template which will return formatted string?

For example, if one call template like

The one get result like:
 * Key1 = Value1
 * Key2 = Value2
 * Key3 = Value3

May be there is a trick? Or is it possible to use #arraymap and #arraymaptemplate for single values only?


 * Not sure to understand your needs, but I guess a combination of explode function and arraymap should do the trick.


 * Steph.


 * Thank you, Steph! This is just what I need! #explode is the answer, but to make it work we need to set   for ParserFunctions extension.
 * To make the answer complete and for the ones who may search for such an example, there are two additional templates below to make it work:
 * Template:Make list:
 * Template:Make list item:
 * I put this answer with some more examples to my site. Thanks again! Pavel Malakhov (talk) 03:19, 9 June 2018 (UTC)
 * I put this answer with some more examples to my site. Thanks again! Pavel Malakhov (talk) 03:19, 9 June 2018 (UTC)
 * I put this answer with some more examples to my site. Thanks again! Pavel Malakhov (talk) 03:19, 9 June 2018 (UTC)

defining readonly inputs
In html, it is possible to create a form input that the user can not edit. For example:  I'd like to do this in Page Forms however, in PF, this doesn't work: What can/should I do?


 * The closest you can get is putting "restricted" instead of "readonly" - admins will still be allowed to edit the field, but no one else will. Yaron Koren (talk) 21:54, 7 June 2018 (UTC)


 * As an alternative, you can make the field "hidden" and show a in the form outside of a field definition, so that the date will be seen by user but no input field will. Steph.

How to stop existing sections loading into new section input-box?

 * 1) Create a form call Form:AddItem. Paste in the following:
 * 2) Create a page called Launcher. Add the following code:
 * 3) In read-mode, click that link, enter some test text, click Save.
 * 4) Browse to page MyList. See new section created with your test-text.
 * 5) Edit Form:AddItem. Change section|Monkeys to section|Pies and save the form.
 * 6) Browse to Launcher. Click the "Add Item" button.
 * 7) At this point, the input box contains the text of the previously entered section.

How to stop the text of the previously entered section from showing up in the new form? Johnywhy (talk) 03:50, 11 June 2018 (UTC)


 * I don't know - this may possibly be a bug, since text under a different section header should probably be counted as "free text", not as section contents. You could always just delete the text, though... Yaron Koren (talk) 03:59, 11 June 2018 (UTC)

But, i don't want to delete the text, i don't want to touch the text. I want the form to add a new section to the page, without touching the existing sections. Is it possible? Johnywhy (talk) 04:04, 11 June 2018 (UTC)


 * The only way I can think to do that is by adding a new section to the form, instead of changing an existing one. Yaron Koren (talk) 14:40, 11 June 2018 (UTC)

Ok, thx, that makes sense. Johnywhy (talk) 15:20, 11 June 2018 (UTC)