Extension talk:Page Forms

How can I display a list of subcategories of a given category in a dropdown?
I'm building a form where I want to let users select a category in which to place the new page. I've tried getting this list of categories from:

1) Cargo - it appears to only let you query data created to store in Cargo

2) CategoryTree - it seems like you can only render collapsible lists in HTML

3) DynamicPageList3 - this seems to work pretty well, but renders categories as links, not as plain text that can be comma-separated and used with the "values" property.

I could use Cargo to store this list of categories separately but I'd prefer not to create a second source of truth for categories.

Any ideas? Nicholasalanbrown (talk) 04:01, 9 January 2023 (UTC)


 * I'm guessing that there are ways to do this with both Cargo and DPL3, but the simplest approach might be to use "input type=tree", with the "top category=" parameter. It's not a dropdown, but hopefully it's close enough - and it will be especially helpful if you ever have more than one level of subcategories. Yaron Koren (talk) 14:04, 9 January 2023 (UTC)
 * I use this approach:.
 * I've found Cargo's storage of categories in the _pageData table to be completely unreliable (it might just be a problem with my databases) but I think the approach here uses category information straight from MediaWiki. Jonathan3 (talk) 10:37, 24 January 2023 (UTC)
 * You must use own template code. Use: Extension:ParserFunctions, Extension:Loops, Extension:Variables and code for DPL which I wrote for you here -- Want (talk) 21:43, 9 January 2023 (UTC)

Get the value of a field the user has completed/selected?
I have a form that has two dropdowns, one for country, one for state/territory. Is there any way to populate the list of states/territories depending on which country is selected? I have both countries and states/territories stored as categories, the issue is I need one field to react to the value of an earlier selection. How do I get the value the user selects for country? This this would be straightforward with jQuery, wondering if that's the only way or if Page Forms can accomplish this somehow. Nicholasalanbrown (talk) 04:00, 13 January 2023 (UTC)


 * Yes, it's doable if you're also using either Cargo or SMW to store the data; see Dependent autocompletion. Yaron Koren (talk) 19:12, 13 January 2023 (UTC)
 * After a few days of playing with "values dependent on" I realized this feature does not work as I expected.
 * For context, I have three Cargo tables/forms/templates: Proposals, Countries, and Regions.
 * What I want to achieve is the following:
 * I manage relationships between Regions and Countries by storing a "Country" field in the Regions Cargo table, as well as a field in the template.
 * In the Proposal form I have two comboboxes, one for Country and one for Region, for the latter I have a "values dependent on=Proposal[Country" property, as I've seen in many examples.
 * What I was hoping would happen is that after selecting a Country, the Region combobox would only show Regions Cargo table records where the value of "Country" was the same as that I had selected (e.g. if I selected "United States" in the Proposal Form, I'd only see states like "Alabama" appear and not provinces of Canada).
 * What actually happens is that the "Country" combobox shows only whatever Countries have been included in Proposal data, not all Countries from the Cargo Countries table. Similarly for the "Region" combobox, it shows any Regions stored alongside the selected Country in existing Proposal entries. I am aware that I can fix the "Country" issue by explicitly calling the cargo table and cargo field properties, but I'm not sure how to achieve the desired behavior for "Region."
 * Is what I am trying to achieve possible with Page Forms? Perhaps it's possible to use the "cargo where" property listed in the docs (I have not been able to find any examples of this). Nicholasalanbrown (talk) 03:25, 18 January 2023 (UTC)
 * Right - unfortunately, the way dependent autocompletion is defined, you can only get the dependent values for the region from the "Proposals" table, not the "Regions" table. I'm aware that sometimes that's not the ideal behavior, but that's how it's done right now. One hack you can do to get around this problem is to create a page with a whole bunch of calls to the "Proposal" template, one for each country and region. It's not an ideal solution, because it creates a whole bunch of bad data, but if all the data is confined to one page, then maybe it's not a huge problem. And that way the autocompletion will work. Yaron Koren (talk) 19:10, 18 January 2023 (UTC)

[solved] How to create page names with underscores
When creating a new page with PageForms, underscores in page names get converted to spaces by Mediawiki. How can I prevent this? I need a page with the name "test_test" and not "test test". RacingRalf (talk) 09:29, 13 January 2023 (UTC)


 * MediaWiki by default doesn't allow underscores in page names; you can get around this problem by calling DISPLAYTITLE - see here for an example. So I suppose you could add a call using a combination of DISPLAYTITLE, #replace (from ParserFunctions) and PAGENAME to the relevant template, assuming you want to have underscores for every such page. Yaron Koren (talk) 19:18, 13 January 2023 (UTC)


 * Thanks again Yaron!

[solved] Problem creating page with similar name to old page
I want to create a new page. The first 91 characters of its title are the same as the first 91 characters of an existing page's title (including 5 for the namespace and 1 for the colon). When I try to create the new page, I am taken to the form for the existing page instead... Jonathan3 (talk) 10:29, 24 January 2023 (UTC)


 * Those are some long page titles! Anyway, I assume you're talking about #forminput. Could it be that it's autocompleting on the existing page name? Yaron Koren (talk) 14:45, 24 January 2023 (UTC)
 * I concede that the titles are long :-)
 * The #forminput has an autocomplete on category parameter so I'll see what happens with that removed. Jonathan3 (talk) 15:27, 24 January 2023 (UTC)


 * I can't remember which page it was doing this with, and can't get it to happen again today, so it looks like I'll never know. I'll mark it as solved anyway! :-) Jonathan3 (talk) 22:48, 27 January 2023 (UTC)

Edit text of "Create or edit" button?
Is there any way to edit the text of the "Create or edit" button that appears in step one of the two-step process? Nicholasalanbrown (talk) 02:08, 29 January 2023 (UTC)


 * Yes, with the "button text=" parameter of #forminput. Yaron Koren (talk) 20:09, 2 February 2023 (UTC)
 * Thanks! I'll try that. Nicholasalanbrown (talk) 02:05, 5 February 2023 (UTC)

Sort order for inputs
I have a field. Property HasCredential has a list of allows value entries that is alphabetically sorted. When I start typing in the input field the options come up as driven by the property, but they are not sorted. I had a similar problem with a field which sorted all but one value correctly. I replaced that one with a manual list but that's obviously not desirable. Is there anything I can do to sort the values alphabetically? I searched the discussion pages and similar things have come up occasionally but I didn't find a solution. I asked this question some weeks ago, but that post was archived without any answers, so I am re-posting. Tenbergen (talk) 19:53, 2 February 2023 (UTC)


 * That sounds like a bug. Is there any order to the sorting? And do "property" vs. "values from property" result in different sorting? Yaron Koren (talk) 20:11, 2 February 2023 (UTC)


 * Changing it from "property" to "values from property" fixed the sort order in the control of type token, but not in the control of type listbox. The listbox draws from a property of type text that has about 20 different values; all are sorted as expected, except for one which is listed as the top except in the middle as it should be. ie the listing is ("external", "allergy and clinical immunology", ..., "Rheumatology") Tenbergen (talk) 18:20, 22 February 2023 (UTC)

Nested multiple-fields for planning a rollout
Hello everyone,

I would like to develope a form to plan a rollout for our IT department. My idea was to have a form with template-fields with the property multiple. So you can add multiple elements via one form.

My approach was to have a page for the main location - building. On this page I add rooms. Inside these rooms I want to add tasks. However, "multiple" seems to not support nesting.

My stripped version of the code looks like this:

Since this doesn't seem to work, I'm struggeling to find an alternative. I would appreciate if someone could give me a hint for a different approach.

Thank you kindly in advance. Fmilk (talk) 07:16, 3 February 2023 (UTC)


 * Yes, unfortunately multiple-template instances can't be nested inside one another - you are restricted to just a two-dimensional table of data within a page, not more dimensions than that. I think the only solution is to have separate pages for rooms and/or tasks. Yaron Koren (talk) 14:03, 3 February 2023 (UTC)

Cargo mapping value field
I think I'm misunderstanding the idea behind the mapping cargo value input. I was hoping it would allow for a form input to display a field from a cargo table and save a different field from that same row to the form template.

In my example regardless of what I put in cargo value field, the result only saves what is in cargo field.

Here is my example Form - this form saves to a cargo table called PeopleAlternateName

The PeopleID is a combobox, which I would like to display the field Name from the People table - this is working. But I was hoping the value field which is the ID field from the People table would be the value saved in the cargo table - instead it is saving the field Name

Is the cargo value field for something else - and not what I am trying to achieve here? Thank you for any help. Temujen510 (talk) 22:07, 12 February 2023 (UTC)


 * I think that field tag should instead look something like:
 * Sorry that this looks so complicated - part of what makes it so "busy" (five parameters) is the seemingly unusual setup you have, where each Person page has both a Name and ID field, but neither one is the page name. (I think.) Yaron Koren (talk) 21:42, 13 February 2023 (UTC)
 * Thank you!
 * I had wondered what the difference was between cargo table=people and mapping cargo table=people, but I think I understand now.
 * I added the extra mapping to the final cargo value field=ID, and everything worked great. Temujen510 (talk) 21:55, 13 February 2023 (UTC)
 * I added the extra mapping to the final cargo value field=ID, and everything worked great. Temujen510 (talk) 21:55, 13 February 2023 (UTC)

Can checkbox fields also store values as 0/1 in templates?
Good evening y'all

The checkbox fields in my form store values as Yes/No in templates. That's in contrast to radiobuttons, which store them as 0/1 in templates; both being Boolean of course. Is it normal for checkbox fields to store values as Yes/No, or could one of my configurations be causing this?

Btw, Yes/No values are correctly stored as 0/1 in the associated Cargo table (the checkbox variables are set to Boolean in #cargo_declare). However, if possible it would still be useful to have the values stored as 0/1 in the wikitext. E.g., to use Boolean expressions on the page that holds the template. For instance, to display a warning message if parameters 1, 2 and 3 are all true.

Cheers, Devaroo (talk) 22:14, 16 February 2023 (UTC)


 * I didn't know that the "radiobutton" input type, when used with a Boolean field, printed out 0 or 1 onto the page - that might be a bug, actually. But what is the call (presumably using ParserFunctions) that can only work if 0 and 1 are used, not No and Yes? Yaron Koren (talk) 02:40, 17 February 2023 (UTC)
 * Yes, I'm talking about a parser function. #expr and #ifexpr only take numbers. I've found the latter useful for displaying different messages if several parameters are all false (or not). Like this . Or is there another easy way to do this? Nested #switch statements work but that's an awkward solution. Also Cargo queries would work, but I feel like that shouldn't be necessary when evaluating parameters on the template page itself. Devaroo (talk) 00:16, 21 February 2023 (UTC)
 * Oh, that's interesting - yes, 0 and 1 values do make those kinds of AND and OR queries easier. I suppose you could replace every instance of  with something like   Yaron Koren (talk) 16:50, 21 February 2023 (UTC)
 * Yep that's exactly what I've done. Although it's even more complicated if you'd like to use the template on wikis with different languages, given that Boolean values will be saved with localized names. So you'd either have to localize the template or use  /   instead of   and  . Numbers would make that step redundant, too... In all, not a huge issue however, as you say, it would be more elegant/efficient with 0 and 1. Anyway, if I understand correctly that's not currently possible, right? Perhaps that would be a nice feature addition. I.e. add a parameter to the field tag to indicate if Boolean values should be stored as text or numbers? Devaroo (talk) 21:13, 21 February 2023 (UTC)
 * It could be a nice parameter, yes. Yaron Koren (talk) 01:43, 22 February 2023 (UTC)

Creating a form for anonymous users on a private wiki
Hi there,

We have a private wiki containing the following settings:

But we would like to have a fairly large form for submitting applications for a scholarship program that would need to be accessible to anonymous browsers. They need to be able to fill it out and submit, resulting in the creation of a new submission page on the wiki. This form includes uploadable fields, applicants must be able to submit PDF documents and a photo.

I've tried whitelisting the form and Special:Upload with  setting, opening edit while keeping read rights closed: Works for filling out fields but not upload files. It's also problematic because pages are all editable by anyone.

Is there a way to make this work? Or do i need something like SemanticACL to get really granular enough to do this?

Thanks so much for the help!

Jeremi Plazas (talk) 18:31, 24 February 2023 (UTC)


 * If users aren't allowed to make edits, then they can't create pages - so yes, something more granular would be needed. (I don't know how you were able to get everything but file uploads working with that setup.) One simple option that may work is to make a separate namespace for applications, and then use an extension like Lockdown to block anonymous editing of all namespaces except that one and the File: namespace. Yaron Koren (talk) 14:45, 2 March 2023 (UTC)
 * Oh that's not a bad idea. We use that extension already. The only problem I see happening is spamming. There is captcha for the form but it's not foolproof. As is noted in the docs. I think we might end up making people create an account anyways, then submit their form. I think that's pretty standard practice at this point. That should give us the flexibility we need. Thanks Yaron!
 * Jeremi Plazas (talk) 17:37, 2 March 2023 (UTC)

Linking edit button to forms when using Page Forms and Tweeki
Last year, after the upgrade from version 5.4 to 5.5. we had an issue with the edit buttons on Tweeki no longer linking to forms (action formedit) but rather linking to visual editing (veaction edit). At that point we were able to resolve the issue by upgrading Tweeki from version v.1.2.5 to v1.2.6. In the meantime we are using the latest version of Tweeki which is v2.0.2. After upgrading to Page Forms 5.6 we are again running into the same issue. The solution here was rolling back to version 5.5.1 of Page Forms. Do you happen to know which change in Page Forms may be causing this? &#91;&#91;kgh&#93;&#93; (talk) 08:36, 2 March 2023 (UTC)


 * I have no idea - I don't think I had heard of that problem before, and I don't see how Page Forms could affect that anyway. Yaron Koren (talk) 14:47, 2 March 2023 (UTC)
 * Thanks for your assessment. I will bring this issue to the attention of the Tweeki developer. Perhaps he has a clue. &#91;&#91;kgh&#93;&#93; (talk) 10:26, 3 March 2023 (UTC)

Fatal exception of type "MalformedTitleException" but keeps repeating
The form used to work without a single problem, but however since this error was first reported, it have gotten worse and now I can't even edit using VE or source mode... This page here suffer the same issue, but with a "localized" error name. I have checked for the associated form and templates, and of course, no issues with them at all...

Using the form directly with "Sửa bằng mẫu" and press "Lưu", the "true" culprit to be known as an invalid character "  ", but I can't seems to find that character anywhere, at least in the title name, and any of the related templates too. MW Song Ngư (talk) 12:24, 13 March 2023 (UTC)


 * Is this a Page Forms issue? As seen in the the page you linked, this error seems to happen outside of forms as well. Yaron Koren (talk) 15:35, 13 March 2023 (UTC)

Description of Page Forms $wg... parameters
These are listed on the infobox, but is there a page describing them? Thanks.

Jonathan3 (talk) 22:35, 16 March 2023 (UTC)


 * Wow, that's a lot of settings! A fair number of these, though, are not actually settings, but just global variables used internally by the code - I think at least $wgPageFormsAutocompleteValues, $wgPageFormsCalendarValues, $wgPageFormsCargoFields, $wgPageFormsContLangMonths, $wgPageFormsDependentFields, $wgPageFormsEmbeddedTemplates, $wgPageFormsFieldProperties, $wgPageFormsGridParams, $wgPageFormsMapsWithFeeders and $wgPageFormsShowOnSelect fall into that category. That still leaves about 25 or so actual settings. I'd like to think most of them are already covered in one place or another in the documentation, but some definitely aren't. (And some I have absolutely no memory of.) Would it be helpful to list them all in one place? I would think it makes more sense to include each one in the relevant section for that functionality. Yaron Koren (talk) 00:57, 17 March 2023 (UTC)
 * I think it would be helpful to list them in once place. That is common for MediaWiki extensions. But that list could simply link to the relevant parts of the documentation. Not having a list made it harder to find the answer to Topic:Xeg9i93clyidf4gh (although I think that's an example where the answer was in the documentation). Jonathan3 (talk) 11:12, 17 March 2023 (UTC)
 * Well, feel free to create such a list - I would think the installation section is the best place for it. If you decide to make it, let me know if you need help with it.
 * By the way, three more global variables that I think are not actually settings: $wgPageFormsCalendarParams, $wgPageFormsGridValues and $wgPageFormsRunQueryFormAtTop. Conversely, though, there are at least one or two actual settings that are not currently in your list, like $wgPageFormsGoogleMapsKey. Yaron Koren (talk) 13:12, 17 March 2023 (UTC)
 * I'll make a start. The list above is copied from the extension page infobox's "Parameters" row. It seems that a Lua module gets them automatically. I wonder whether there is any way to remove the parameters which are not parameters from that list. Jonathan3 (talk) 15:08, 17 March 2023 (UTC)
 * Interesting - yes, it looks like there are two problems with that automated listing: it lists the global variables that aren't actually params, and it doesn't list some variables - specifically, it ignores all global variables that default to "null". I just added a note about that second issue here. But it seems to me that the best course of action, if there are users who are actually looking at that "Parameters" listing, is to replace that automatic list with a manual one, by adding a "parameters=" value for the Extension infobox. Yaron Koren (talk) 16:57, 17 March 2023 (UTC)
 * Good idea. It seems that any wikitext can be added as a "parameters" parameter. Here's a first draft.
 * $wgPageFormsAutoeditNamespaces
 * $wgPageFormsIgnoreTitlePattern - mentioned in version history but not documentation
 * $wgPageFormsShowTabsForAllHelperForms
 * $wgPageFormsLinkAllRedLinksToForms
 * $wgPageFormsShowExpandAllLink - mentioned in version history but not documentation
 * $wgPageFormsCacheAutocompleteValues
 * $wgPageFormsRenameEditTabs
 * $wgPageFormsMaxAutocompleteValues
 * $wgPageForms24HourTime
 * $wgPageFormsEmbedQueryCacheTTL - mentioned in version history but not documentation
 * $wgPageFormsHeightForMinimizingInstances
 * $wgPageFormsRenameMainEditTab
 * $wgPageFormsAutocompleteOnAllChars
 * $wgPageFormsCacheFormDefinitions
 * $wgPageFormsDisableOutsideServices
 * $wgPageFormsMaxLocalAutocompleteValues
 * $wgPageFormsCheckboxesSelectAllMinimum
 * $wgPageFormsUseDisplayTitle - can't find
 * $wgPageFormsListSeparator - can't find
 * $wgPageFormsSimpleUpload
 * $wgPageFormsVisualEditorMaxHeight - mentioned in version history but not documentation
 * $wgPageFormsGoogleMapsKey (not currently in infobox)
 * $wgPageFormsAutocompleteCacheTimeout (not currently in infobox)
 * Jonathan3 (talk) 23:04, 17 March 2023 (UTC)
 * This looks great! A few of those settings you couldn't find are actually in the documentation, but as a first version of the "parameters" value, this definitely looks good enough already - the links are a nice touch. Yaron Koren (talk) 13:48, 19 March 2023 (UTC)
 * Cheers. I've added them to the extension page. I still can't find the ones I couldn't find, though. Jonathan3 (talk) 21:04, 19 March 2023 (UTC)
 * Thank you, this is great! I'm glad you alphabetized them also. I added some more links, so now there are only four undocumented variables - I hope to add them to the documentation at some point, though thankfully they're all fairly obscure settings. Yaron Koren (talk) 12:51, 20 March 2023 (UTC)

Choose which columns to show in Special:MultiPageEdit
Is it possible to get rid of some of the columns in this page, or at least show only the first x characters of a Text/String field? My aim is just to tidy the page up to make it easier to navigate. Thanks. Jonathan3 (talk) 21:26, 18 March 2023 (UTC)


 * Neither of those is currently possible, unfortunately. Yaron Koren (talk) 13:52, 19 March 2023 (UTC)

"displayed fields when minimized" parameter
Is there an online example of this working?

Are there some types of fields that just cannot be shown? It looks like anything with  doesn't show, whereas the same (Cargo) field changed to   shows up all right.

Jonathan3 (talk) 12:35, 20 March 2023 (UTC)


 * Sorry for the delay. I don't know if there's an online example - although it sounds like you have it working, other than for "tokens" inputs? That could certainly be a bug. Yaron Koren (talk) 13:02, 27 March 2023 (UTC)

Mapping property not working in latest PF
Dear Yaron, after upgrading to PF from a considerably older version in a brand-new environment (PHP 8, latest SMW, MW 1.39), I found a couple of issues, one being that the mapping property is broken in a number of different contexts. Here are some that I found:


 * It no longer works for tokens and comboboxes in query forms (use case: values from property)
 * It still works in editing forms if "values from property" is used.
 * It does not work correctly in editing forms if "values from concept" is used. When you start typing something, I see the bare pagenames. Also, search is now sensitive to case and diacritics, which is an inconvenient regression. It is only when you select something from the list of options that the pagename is replaced with the value from the mapping property. If I double-click to edit the token, the pagename is visible again (which seems right), but if I then hit enter, I get two tokens for the price of one: one showing the pagename, the other showing the mapping property value.
 * I have also tried the alternative approach by using the new "values from query" parameter (big thumbs up for introducing this!). Case/diacritic-insensitive search worked, but only on pagenames - the mapping property gets ignored.

I could try slightly earlier versions to see if these issues are recent and if so, when they began.

Cavila 11:15, 27 March 2023 (UTC)


 * I just had a look at PF_FormField and it appears that there is an issue with "values from property" + "mapping property" rather than mapping properties in query forms as such. After $f->mPossibleValues is first set for "values from property", the array of possibles values is emptied, accidentally I presume, by the time we have arrive at line 405 ("$f->setPossibleValues"). Cavila 12:51, 27 March 2023 (UTC)
 * I'm not surprised that there are issues with "mapping property" - it's not well-tested. It's great that you may have found the problem. If you can submit a patch for this (or send me one), that would be great. Yaron Koren (talk) 13:09, 27 March 2023 (UTC)
 * Sure, I'm currently looking into other stuff, too, but I'll keep you posted. Cavila 18:07, 27 March 2023 (UTC)

Sorting Issues
The problem I'm having is that upon changing existing or adding new SMW Property values, the sorting of the Property values (type=Text) in both #ask queries and in field dropdowns of Forms display the properties in their order of create/update. For example, take the following alphanumeric Property values: ... if I change the first to "01-Tools and Equipment", I get the following sort order in dropdowns and #ask queries (with sorting specified): Similarly, if I create two new values like "13" and "11" (in that order), "11" will always sort after "13".
 * 01-Tools & Equipment
 * 02-Extenders
 * 02-Extenders
 * 01-Tools and Equipment

Example query: I have tried forcing updateCollation.php without any luck, and my collation is default anyway. Is this something specific to Property that Category does not suffer? As of now, my only solution is to destroy my property and rebuild it with all values from scratch ... and this may not even work, IDK. ~z929669 Talk 19:47, 29 March 2023 (UTC)
 * UPDATE:  fixed it