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!

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)