Extension talk:Page Forms

Auto-fill multi-instance template from previous one
Is this possible? I have in mind a tick box like you often see on a shopping website alongside "Shipping address is same as billing address".

The idea is that the subsequent ones would be mostly the same, so it would be easier to change one or two things than type several. Jonathan3 (talk) 22:30, 13 April 2023 (UTC)


 * There's no easy way to do that, but what you can do instead is have it say something like "Leave the shipping address blank to use the billing address for shipping" - and then have the template handle it. Yaron Koren (talk) 03:04, 14 April 2023 (UTC)
 * Thanks. What are the difficult ways? Jonathan3 (talk) 08:55, 14 April 2023 (UTC)
 * Using a PHP or JavaScript hook to add custom code. Yaron Koren (talk) 16:46, 14 April 2023 (UTC)

Combobox Autocomplete Not Finding Results
Per the documentation, I have a table that contains many items with accents, special characters, etc that also has 800+ items in it (hooray video game inventories). So I'm thus required to use a combobox if I want to enable users to select items from that Cargo table as entries.

This is my code:

I've also tried adding "with autocomplete" to the combobox but that does not work.


 * I've rebuilt the Cargo table.
 * I've tried pointing it to other Cargo tables on my site that are much smaller by changing cargo table/cargo field--this works fine.
 * I've pasted literal entries that I've copied from the Cargo admin view showing me entries in the table--No matches.
 * All I ever get is "Please enter 1 or more characters." Even if I type something (instead of paste) that I know is in the table, I am told "No matches."

What have I missed? SovereignGFC (talk) 22:43, 17 April 2023 (UTC)


 * Does this also happen with items with ASCII names, i.e. no accents or other special characters? Yaron Koren (talk) 10:34, 19 April 2023 (UTC)
 * I have done a test with a small set of special character names:
 * Shakudō Chrysanthemum Pendant
 * Partagás Cigars (Perfectos Finos)
 * Médaille d'honneur (Vermeil)
 * Letter of Regard from İsmet İnönü
 * This works.
 * Unfortunately, that means there's something in a table that has over 800 rows that is causing a problem. I will try to narrow it down as I have imported the data in six different sections. SovereignGFC (talk) 00:11, 20 April 2023 (UTC)
 * Update 4/22/23...
 * Unfortunately I'm even more confused. I took one of the six chunks, found all entries with non-Latin characters (including ' which apparently counts), and imported that list on its own.  Those all worked fine.
 * I did the reverse, only Latin. This also worked.
 * But when I import the whole spreadsheet including both the Latin and non-Latin entries, I get "Please enter one or more characters" in the form drop-down.


 * Something's wrong with the import. When I import JUST the non-Latin from spreadsheet, then JUST the Latin-only (doing it in two parts), it works fine.
 * SovereignGFC (talk) 19:17, 22 April 2023 (UTC)
 * This is not necessarily a bug - the "Please enter one or more characters" message shows up when the input uses remote, instead of local autocompletion, which in turn happens when the number of total possible values for that input is above a certain number, by default 200. So that is probably what is happening when you import the entire spreadsheet. The issue is only what happens after you type in one or more characters. Is remote autocompletion not working at all, for any values? Yaron Koren (talk) 22:56, 23 April 2023 (UTC)
 * OK so I'm on my 101st item. Per the documentation, that causes remote autocompletion.
 * When I type the name of something I know is in there (or paste it from the table), nothing comes up. It simply says No Matches.
 * Do I need to check/modify settings on my server/in my installation since that number of items switches to treating my own server as "remote" autocompletion? SovereignGFC (talk) 02:08, 24 April 2023 (UTC)
 * Oh yeah, 100. Here is one way you can check: open the browser console, and go to the "Network" tab. (Hopefully there's one in whatever browser you are using.) Then type into the autocomplete input. Presumably every character you type will lead to a new API URL showing up under "Network". Go to any of these in a new tab or window - that will show what the API is returning. Yaron Koren (talk) 02:29, 24 April 2023 (UTC)
 * Got it.
 * So the final result is this once I've completed typing in the whole value.
 * Object { code: "internal_api_error_MWException", info: "[ZEaDDQb_wJ5pfNAW-Y93kQAAAow] Caught exception of type MWException", errorclass: "MWException" } SovereignGFC (talk) 13:28, 24 April 2023 (UTC)
 * Okay, now we're getting somewhere. Could you please add the line  to your LocalSettings.php file? That should make for a more helpful error message. Yaron Koren (talk) 13:51, 24 April 2023 (UTC)
 * Exception caught: Error: the string "`" cannot be used within #cargo_query.' SovereignGFC (talk) 20:45, 24 April 2023 (UTC)
 * Okay, that explains it. From March 8 to March 23, there was code in Cargo that disallowed that backtick string in queries. It was removed because it caused some problems, including with Page Forms autocompletion. If you update your Cargo code - or, for that matter, if you keep the existing Cargo code but update your Page Forms code - the problem should go away. Yaron Koren (talk) 14:13, 25 April 2023 (UTC)
 * Updating to version 5.6.1 resolved the problem. SovereignGFC (talk) 12:38, 26 April 2023 (UTC)
 * Great! I'm glad to hear that there was no problem with non-ASCII handling. Yaron Koren (talk) 13:46, 26 April 2023 (UTC)

Show on select only working once (first instance of ID)
Is the "Show on select" parameter only supposed to work one time on the page? I'm surprised by this. Unless we did something wrong on our setup. We have recently updated things but I thought it used to work for all instances of the ID specified.

Is there any way to make it work for more than one id at a time? For example

Section one for books. Section one for dissertations. Section one for tibetan. Section one for sanskrit. Section one for classical. Section one for issues.

Section two for books. Section two for dissertations. Section two for tibetan. Section two for sanskrit. Section two for classical. Section two for issues.

Section three for books. Section three for dissertations. Section three for tibetan. Section three for sanskrit. Section three for classical. Section three for issues.

Making it so it'll work on all three sections of elements here, and when Books is selected the three divs with id="books" are shown, all the others are hidden?

Thanks!

Jeremi Plazas (talk) 19:53, 20 April 2023 (UTC)


 * You can have something like, if that's what you're asking. Yaron Koren (talk) 13:45, 21 April 2023 (UTC)

Editing forms with Minerva Neue mobile version
I try to edit forms with Minerva Neue from a mobile and some troubles happen with JS -- for instance for tokens. An exemple here. I am using the last master branch and Mediawiki 1.39.

Is there a solution to fix it?

Thanks by advance! Manu.wikidebats (talk) 18:42, 28 April 2023 (UTC)

Problems with "Edit with form" tab and preview when using Page Forms
I'm having 2 problems with PageForms in MediaWiki version 1.39.

1. The "Edit with form" button does not appear on pages configured with Page Forms.

- I checked if there was any conflict between the extensions, but there wasn't.

- I cleared the cache.

- The settings are configured correctly.

I would like to know what it could be and how to solve it.

2. When I click to preview a page I'm creating using Page Forms, the preview doesn't work and I get the

following sentence: EditPage does not have a context title set

What could be causing this problem?

Thank you so much in advance! Sakura.tech (talk) 20:26, 28 April 2023 (UTC)


 * What do you mean by "configured with Page Forms"? And what version of Page Forms are you using? Yaron Koren (talk) 21:14, 28 April 2023 (UTC)
 * Hello Yaron
 * I mean by configured with Page Forms, the pages that were created using Page Forms
 * The version of Page Forms is 5.4 2804:14C:6581:5A74:5889:C932:D29F:4436 03:43, 29 April 2023 (UTC)
 * See here for how to get the "edit with form" tab to display. Yaron Koren (talk) 15:08, 1 May 2023 (UTC)
 * Thanks @Yaron Koren the tab is showing now. Regarding the second error, do you know what it could be? 2804:14C:6581:5A74:615F:5257:4FC7:E1BA 19:00, 5 May 2023 (UTC)
 * What is the full error message, including file and line number? Yaron Koren (talk) 20:44, 5 May 2023 (UTC)
 * File: EditPage.php, line number 566.
 * Full error message: "EditPage does not have a context title set"
 * I don't think it's an error in the code, maybe it could be a bug. When I click on preview to see the page I'm creating with PageForms it says "EditPage does not have a context title set" and I can't see the preview of the page 2804:14C:6581:5A74:615F:5257:4FC7:E1BA 21:10, 5 May 2023 (UTC)
 * Doing a web search on that error message, this looks like it could be a conflict with either the CodeEditor or TinyMCE extension. Do you have either of those extensions installed? Yaron Koren (talk) 21:48, 5 May 2023 (UTC)
 * I had CodeEditor installed, I removed it and PageForms worked. But I need to use CodeEditor too, what do you recommend I do in this situation? 2804:14C:6581:5A74:B1B1:AE12:FBC4:ADD9 13:08, 9 May 2023 (UTC)
 * I don't know... until this bug is fixed, I don't know if there's a real solution. Yaron Koren (talk) 19:13, 9 May 2023 (UTC)

Remote autocompletion: final part of string replaced with hash
This issue has come up before, e.g. in the archives here and here. The problem can still be reproduced on the website of the user who posted in 2017: https://wiki.fabricioassumpcao.com/w/api.php?action=pfautocomplete&property=Bibliographic_review&substr=campo%20500.

Does anyone know of a solution, or where we might look for one? Could it be related to the maximum search length of 40/72 characters and if so, would it help to set smwgFieldTypeFeatures to SMW_FIELDT_CHAR_LONG ? At its core, it's probably an SMW issue, but the context is squite pecifically PF. Rand(1,2022) (talk) 17:02, 20 May 2023 (UTC)

Define forms to appear on "form chooser"
Hello,

Am looking for a way to list or not list a specific form when $wgPageFormsLinkAllRedLinksToForms = true; is defined on localsettings.

Alternatively, the way define principal and other form on the listed choice.

Thanks for your help! Willyedoo (talk) 10:13, 24 May 2023 (UTC)


 * Unfortunately there is no way to customize any of it - whether forms show up at all, or whether they show up in "Main forms" or "Other forms". What kind of customization would you want to have? Yaron Koren (talk) 14:00, 24 May 2023 (UTC)
 * Customizing what falls to "main forms" and what falls to "Other forms" will be usefull in that case.
 * In my UX designing, seaching and being able to use the must apporpriate form is a must. Actually I have Two i want for "Main forms" in total of four showing up now.
 * Thanks for your help! Willyedoo (talk) 15:02, 24 May 2023 (UTC)
 * Okay, that's interesting. Right now the logic is that forms show up in "Main forms" if the number of pages that are editable with that form are more than 1% of the total number of pages in the wiki that are editable with any form. That 1% number is hardcoded - would it solve your problem if that number were settable in LocalSettings.php? Yaron Koren (talk) 15:20, 24 May 2023 (UTC)
 * Hi Yaron,
 * Absolutely, it will solve my problem if i can change it on LocalSettings.php.
 * Thanks! Willyedoo (talk) 09:16, 25 May 2023 (UTC)
 * That's good to hear - I was planning to add a setting for that at some point anyway. I just added the global variable - it's called $wgPageFormsMainFormsMinimum, and by default it's 0.01. If you get the latest code, you can use that setting to increase or decrease the number of "Main forms". Yaron Koren (talk) 15:16, 25 May 2023 (UTC)
 * Many thanks,
 * I will update and customise accordingly.
 * Nice day! Willyedoo (talk) 07:44, 26 May 2023 (UTC)

Autocomplete on multiple Cargo fields
Is it possible for a tokens field to autocomplete on multiple Cargo fields?

Or on the result of a Cargo query (which could have the same effect)?

Thanks. Jonathan3 (talk) 14:22, 25 May 2023 (UTC)


 * If it's a relatively small number of values (say, 200 or less), you could do it just by hardcoding "values=" to a #cargo_compound_query call (don't forget to add "no html" to the query). For a larger group of values, I don't think there's any way to do it, unfortunately. Yaron Koren (talk) 15:23, 25 May 2023 (UTC)

Edit With Form + Dates
When I load an already-created page that has a parameter (or in this case, four parameters) which are defined as Dates in Cargo, Page Forms blanks the values.

I compared the value saved when I fill in the Page Form and the value in the template page. They are identical. Originally I had the date as 01/15/1999 but realized Page Forms saves as 1999/01/15. Despite matching that up, Page Forms still blanks the date that was already there unless I put it in again when editing.

SovereignGFC (talk) 21:23, 28 May 2023 (UTC)


 * That's pretty bad. What version of Page Forms are you using? Yaron Koren (talk) 02:34, 29 May 2023 (UTC)
 * I diagnosed the problem this morning.
 * I had two divs with the same template variables. If dropdown select A, hide divs.  If B, show div 1.  If C, show div 2 (which is the same as div 1 + an extra field).
 * I solved the problem by removing the duplicate template variable calls and accepting that I'd have the C div show for both B and C cases, meaning for B the extra field simply isn't filled (even though it's shown). SovereignGFC (talk) 18:45, 29 May 2023 (UTC)