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)
 * Hi Yaron, no that is not what I meant. But thanks anyways, I found a workaround using a javascript widget. What I was looking for was a  that would work for all elements with same attribute (ID [though i know an ID is only supposed to be used once], or a class).
 * Since this wasn't working and we have too many things to show and hide, I implemented this js code to listen to a radiobutton selection and display all items with a particular classification, and also give a sub-range of values for another "subclass" field:
 * This is working great for us.
 * Jeremi Plazas (talk) 17:06, 8 June 2023 (UTC)
 * Jeremi Plazas (talk) 17:06, 8 June 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)
 * Hello Yaron,
 * When i updated the code, the issue was fixed for form choosing, but a new issue appear on data loading from categorie. Only light categories load, when the category is important nothing load.
 * Am using this code to load data:
 * input type=tokens|values from category=XXXX|list|delimiter=;}}} 163.62.112.85 13:19, 30 May 2023 (UTC)
 * It's great that the form chooser thing is fixed. For this new problem - please create a separate section for it; otherwise it gets confusing. Yaron Koren (talk) 13:36, 30 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)
 * Ah, yes - you can't have duplicate field names, unfortunately, even if only one at a time is shown to users. Yaron Koren (talk) 13:41, 30 May 2023 (UTC)

Form loading field data issue
Hello,

I update my page form recently, and it don't load data on field where data seems te be a important. When the field is link to a category with low data, they load fine. When the category have more data, the form keep loading and nothing appear.


 * Am using this code to load data:
 * input type=tokens|values from category=XXXX|list|delimiter=;}}}

Thanks for your help! 163.62.112.185 07:34, 31 May 2023 (UTC)


 * I think you are seeing a bug with autocompletion that was in place for the last two weeks, which I just discovered and fixed yesterday. If you get the latest Page Forms code again, the problem should hopefully go away. Yaron Koren (talk) 13:05, 31 May 2023 (UTC)
 * Hello Yaron,
 * I tested the latest code again and found some issue on data loading. Now it shows some data when we start writing on the field but the system isn't acurate and keep showing some text and "rows" of number(0,1,2,3...) as a result.
 * In total some progress but not yet acurate on indexing the content of a category. Willyedoo (talk) 13:44, 6 June 2023 (UTC)
 * That's strange - are you saying that 0, 1 etc. are showing up as autocompletion results when you start typing? If so, do the same values show up no matter what you type? And by any chance, do you have the DisplayTitle extension installed? Yaron Koren (talk) 17:02, 6 June 2023 (UTC)
 * Hello Yaron
 * Yes the values texte typed and (0,1,2,3...) appear no matter what is typed.
 * Yes i have the display extension installed.
 * Thanks! Willyedoo (talk) 08:19, 8 June 2023 (UTC)
 * That is strange - it sounds like there's something unusual going on with mapping, although I don't know what it is. Could you try briefly disabling the DisplayTitle extension, and see if that autocompletion problem still happens when it is disabled? Also, do those values appear even when there are no autocompletion results for that string? Yaron Koren (talk) 12:47, 8 June 2023 (UTC)
 * Hi @Willyedoo, work is in progress to revise some of the mapping options. We're tryimg to divide these revisions into a sequence of patches but it is possible that some interdependencies have been overlooked. In this case, I suspect that the change from indexed to associative arrays is only halfway there, but I will need to look into that. It would be helpful for me to know whether local or autocompletion is being used. You can probably tell by opening up the browser console and see if theere are calls to the API when you start typing something in the tokens field. If so, it means that the form field is using remote autocompletion. Could you check ? Rand(1,2022) (talk) 10:32, 9 June 2023 (UTC)
 * Hi @Rand(1,2022),
 * Am working with edge and i don't see any API call. Unfotunately, I don't have right to add extesion on my browser and console isn't acessible for other web browsers.
 * Thanks! Willyedoo (talk) 15:00, 9 June 2023 (UTC)
 * Okay, I can reproduce the issue and probably identified the flaw in the code (it wasn't me but a new function intended to sort by string length which accidentally messes up the array). I'll submit a fix, probably within a few days. Rand(1,2022) (talk) 17:10, 9 June 2023 (UTC)

Email notification upon form submission?
Hi all, Any solutions or I'll settle for tips or suggestions for getting alerted of new form submissions? Will watchlisting the category that the pages created land in work? Any way to get email notifications somehow?

Thanks so much!

I have looked at CI Forms extension which does provide that functionality it seems, but it won't let you upload files (using an "uploadable" field), so that's a no go. And anyways PageForms is clearly the superior plugin... ;)

Jeremi Plazas (talk) 17:13, 8 June 2023 (UTC)


 * That's nice of you! I think the best course of action is to use the EditNotify extension, which I believe supports the kind of the thing you're asking about. Yaron Koren (talk) 19:33, 8 June 2023 (UTC)
 * Thanks Yaron, that should work great!
 * Jeremi Plazas (talk) 16:11, 19 June 2023 (UTC)
 * Hi Yaron, so i have installed the EditNotify extension and have played with it thoroughly. Unfortunately, it seems to be pretty buggy for my installation (MW 1.35.10). The "action=create" option will notify any and all creations and edits to the users specified, regardless of any other parameter. The "action=edit" option also disregards all other parameters, but at least will omit page creations. Anyways, that's less than ideal. I've posted on the Extension's talk page and also on T240656 which you contributed to.
 * Anyways, we'll see if anything happens. We might also be updating all our sites to 1.39 at some point in the near future. Maybe that will offer some solutions... or new problems.
 * Thanks anyways for your help, as usual!
 * Jeremi Plazas (talk) 22:24, 21 June 2023 (UTC)

Several question about using PageForms with existing templates
Hi, I just started to read more deeply about PageForms and it's seems amazing!


 * 1) I have some templates that their major job is to save data to cargo, I created then long time ago and they don't contain "template_params"&"template_display". I created a Form that use this template and it worked. I'm asking because I want to use it with more complicated templated - should it work as well? (I could not find it in the doc, I just saw why it's important to have these 2 func but not if they are mandatory)
 * 2) I saw this great trick: "query string=namespace=MyNameSpace&=" (to open a new page with the given name from a form), if I want to open a pagename based on the input fields from the user, that possible somehow?
 * 3) I'm not sure how it's work in the background, but If I have a template called "template:save_book_data" that save to cargo and does some more stuff, and I have books pages that looks like: 1. call to "save_book_data" template, 2.have inline data outside of the template. 3. call to other template.  Can I use PageForm to edit them? does PageForm will know to edit only the relevant template from this page or it will replace it all? Thank you very much!

Koshob (talk) 14:39, 9 June 2023 (UTC)


 * Hi -
 * Yes, that should work fine - those two parser functions are optional.
 * I don't understand this question.
 * That should work fine - basically, any text in the page that is not related to the template(s) in the form is simply considered "free text", and is left untouched. (Unless the user edits the free text in the form.) As long as the "save_book_data" template call is at the top of the page, there should be no problem.
 * Yaron Koren (talk) 17:03, 9 June 2023 (UTC)
 * Thanks!
 * 2. I have a Form named "Add Book", at first phase I'm inserting the page name, and after it I'm adding some details like book name, author and so on. As I understand the page name will be what the user inserted at the first place, but if I want the page name to be "calculated" from the user input, for example like this: " _By_  " and I don't want that the user will insert it (I just gave an easy example), that possible somehow?
 * 3. I just tried it myself and if the template is not the first it's moving it to be first, there is anyway topreserve the template p:lace in the page? even with some magic to be written before and after?
 * Thanks you :) Koshob (talk) 22:21, 9 June 2023 (UTC)
 * Hi - for #2, please check out The one-step process - that might be what you are looking for. For #3 - what is the little bit you want to add at the top? Could it be integrated into the "save_book_data" template? Yaron Koren (talk) 19:28, 14 June 2023 (UTC)
 * 2 - looks great!, regarding #3: If it could I wouldn't ask :), I just have another template I have at the top, if I'll merge them the second template will have tons of parameters which is not ideal. Thank you for the help! Koshob (talk) 09:57, 16 June 2023 (UTC)
 * Oh, okay. Well, if that second template is always there, the other option is to simply add it to the form definition, above the other template. That would be the better option, actually. Yaron Koren (talk) 13:17, 16 June 2023 (UTC)

Cargo Where On Dropdown Select
So I have a dropdown field. Let's just say it's colors for the sake of an example. Red, blue, green and form field TXT_Color.

I have a field on the same form using tokens like this: |input type=tokens|cargo table=ColorThings|cargo field=TXT_ThingName|cargo where=TXT_Color=I want this to depend on the dropdown.

If the dropdown select is RED, the items on the token list should be: Apple, Fire Hydrant, Cardinal. If the dropdown select is BLUE, the items on the token list should be: Sky, Blueberry, Fish. If the dropdown select is GREEN, the items on the token list should be: Plant, Broccoli, Lizard.

I don't want the token list having all 9 options from table ColorThings, only 3 depending on what color is selected further up on the form in TXT_Color.

Is that possible? SovereignGFC (talk) 15:17, 25 June 2023 (UTC)


 * Yes, it's possible, but you wouldn't use "cargo where" for that - you should use "values dependent on". Yaron Koren (talk) 13:23, 26 June 2023 (UTC)
 * ...I think I found a new way to push past capabilities.
 * So the drop-down is associated with template A.
 * But the values would be from template B.
 * It doesn't seem to work that way.
 * Traits have a Source in the ITEMTrait table--e.g. Engineer.
 * The Department is a different template and value, ITEMCrew[TXT_Department] but that also contains things like, Engineer. SovereignGFC (talk) 18:24, 30 June 2023 (UTC)
 * The Department is a different template and value, ITEMCrew[TXT_Department] but that also contains things like, Engineer. SovereignGFC (talk) 18:24, 30 June 2023 (UTC)