Extension talk:Page Forms

From mediawiki.org

Change text color[edit]

How do I change the text color of the run query button in standard input? V G5001 (talk) 22:38, 14 January 2024 (UTC)Reply

That would be best done via CSS, ideally on the page MediaWiki:Common.css. Yaron Koren (talk) 05:01, 15 January 2024 (UTC)Reply

Upload Wizard within form?[edit]

A user asked me today: could we get a nice uploader option like Extension:UploadWizard in this form?

I don't love the current uploader option in Page Forms even after updating the interface text, so I was planning to have users upload their files on the wizard page, but having them visit only one form and submit all of their info would be ideal.

I'm guessing this is not possible unless UploadWizard offers an embeddable interface or something, but I figured I would ask. BrownKDocs (talk) 19:35, 1 February 2024 (UTC)Reply

Right, there's no way to integrate UploadWizard. The only customization that can be done right now is with $wgPageFormsSimpleUpload, but that's going in the opposite direction - even fewer fields for the user to fill out. It would be nice to have that option, though I don't know how feasible it is. Yaron Koren (talk) 20:12, 1 February 2024 (UTC)Reply

Style ADD form but not EDIT form in CSS[edit]

Is there a class or id I can use to style form elements when _adding_ a page, but not when _editing_ an existing page in the same form? Tahoma403 (talk) 18:22, 13 February 2024 (UTC)Reply

I don't think so, unfortunately. Would that be useful? Yaron Koren (talk) 20:19, 13 February 2024 (UTC)Reply
Probably not useful in most wikis, but I have added a Delete button in my form, which should be hidden when the page hasn't been created yet. I'm using $(".mw-special-FormEdit .firstHeading:contains(Edit)") to only style the form when editing, just thought there might be a better way. Tahoma403 (talk) 05:34, 14 February 2024 (UTC)Reply
Alright, interesting. Now I'm curious: what does the "Delete" button do? Yaron Koren (talk) 14:10, 14 February 2024 (UTC)Reply
It deletes the page instead of editing it, since I'm hiding the #right-navigation menu (with the standard Delete link). I add this custom delete link next to the Save and Cancel buttons in the form instead:
[{{fullurl:{{FULLPAGENAME}}|action=delete}} Delete] Tahoma403 (talk) 14:52, 14 February 2024 (UTC)Reply
Oh, of course. That seems like a strange user interface - why would you go to edit a page if you want to delete it? - but I'm glad you got it working somehow. Yaron Koren (talk) 15:26, 14 February 2024 (UTC)Reply
Yes, my interface is a bit different. Instead of the actions toolbar, I'm adding a custom Edit link next to the header on all pages. Regular users wouldn't usually need to delete/move pages anyway, so I like to keep the main interface clean with fewer options.
I still need to use JS to position the custom Delete link at the bottom of the form, so using .firstHeading:contains(Edit) isn't a problem. Tahoma403 (talk) 07:43, 15 February 2024 (UTC)Reply
I get it, thanks. Yaron Koren (talk) 14:38, 15 February 2024 (UTC)Reply

Table output format does work if you use #template _display[edit]

By default when you create a template and don't check "Use full wikitext instead of #template_display" and choose a Table Output format .

The table won't work.

To fix it you need to edit source of the template and in #template_display:_format=standard

Change standard to table AjaxDeshayes (talk) 14:25, 14 February 2024 (UTC)Reply

What do you mean by "format=table" not working? For me it seems to work fine. Yaron Koren (talk) 14:39, 14 February 2024 (UTC)Reply
I don't get the fake table if I don't use #template_display
so that's why for me it's a bug AjaxDeshayes (talk) 15:40, 14 February 2024 (UTC)Reply
Oh, never mind - you're saying "format=standard" doesn't work. I misunderstood what you wrote before. Or rather, you're saying that "format=standard" does not display a table. Which is true - this was a bug in Special:CreateTemplate. Thanks for pointing it out. I just checked in what I think is a fix for it. Yaron Koren (talk) 16:09, 14 February 2024 (UTC)Reply
Both have the problem
I try with Page Forms (Pages Schemas was disable)
And Page Schemas (Page Forms was activate) AjaxDeshayes (talk) 16:16, 14 February 2024 (UTC)Reply
I think my fix fixed both extensions. Yaron Koren (talk) 19:26, 14 February 2024 (UTC)Reply

How to choose the form you want to edit with the "edit with form" tab[edit]

Hello Yaron


To Store a employee I use page schemas to create the template and form then I create the cargo table name Employee with the form.

A employee can be a expert and and if he is a expert so he have a expertise.

But there no if statement possible to make the field expertise appear if the satut field hold 'Expert'.

The easy solution should be to trust the user to not enter a value in the expertise field if he isn't a expert but I can't allow that.

My solution was to make a separate table call Expert that hold the field Expertise and remove Expert from the allowed values of the statut field in the employee template .

So if you want to add a expert you enter the name of the employee in the employee form

then you add the same _pageName of the Employee you just created in the Expert form to add him to the Expert table.

So far so good I can joint the _pageName of both table to know if a employee is a expert and have the information present in the Employee table.

But let's say I want to change the expertise of a expert with edit with form tab.

I can't because the only form I can edit is the first one that I used , in this case it's the employee form.

I know I could change the value of expertise field with the edit tab but the entry have no parameter to filter the entry.

I also search solution in the The "edit with form" tab page but couldn't find any.

Is there a easy way for a unexperienced user to change the form that would be edited with the "edit with form" tab if he want to change the expertise of a employee.

Maybe created a separated table is not a good alternative I also didn't use _parentTables or #cargo_attach because is not natively supported within page schemas but I think I should add them in source code of the template Expert every time the Template is regenerated. AjaxDeshayes (talk) 16:26, 23 February 2024 (UTC)Reply

Creating a separate table for this one field seems unnecessary. Is the issue that you want to hide the "Expertise" field in the form, in the page, or both? Yaron Koren (talk) 17:36, 23 February 2024 (UTC)Reply
I want to hide the expertise field when a employee don't hold 'expert' in the field Statut in both in the page and in the form so the user can't add a expertise to a employee that isn't a expert. AjaxDeshayes (talk) 13:33, 24 February 2024 (UTC)Reply
Okay - for the page itself, this is pretty easy to do - if you're using Page Schemas, you just have to select "Display if not empty" for the "Expertise" field. For the form, it's a little trickier: you will have to manually edit the form definition, and add a "show on select" parameter to the "Status" field - see here. Yaron Koren (talk) 14:06, 26 February 2024 (UTC)Reply
Thank you so much i didn't saw that parameter.
The parameter can be placed in the form parameter input so you don't need to add the parameter manually in the source code.
but you need to add manually the div element
the result :
you need to look the source of the message because everything get parser!
! Satus: 
| {{{field|Satus|input type=checkboxes|show on select=Expert=>expertise;}}}
|-
<div id="expertise">
! Expertise: 
| {{{field|Expertise}}}
|-
</div>
! Service: 
| {{{field|Service}}}
|-
but this don't work I think it's because of the div element
Expertise is always show no matter if Expert is check or not in the Status field AjaxDeshayes (talk) 17:39, 26 February 2024 (UTC)Reply
Unfortunately, because of how HTML works, if the div is in a table, you need to turn this into three separate tables - one for the stuff above the Expertise field, one for the Expertise field itself, and one for everything below the Expertise field. Yaron Koren (talk) 21:11, 26 February 2024 (UTC)Reply
Is there still a way to change the default form on page so you can edit different form present on the page ?
Or you absolutely shouldn't use more than 2 form on a page. AjaxDeshayes (talk) 09:12, 27 February 2024 (UTC)Reply
Probably with custom JavaScript, you can do all sorts of tricks. But I confess I don't fully understand what you were trying to do with the two forms. Yaron Koren (talk) 14:29, 27 February 2024 (UTC)Reply
1 form is to add a expert and his expertise and the second is to add a employee.
But thanks to you and the show on select I don't need another template and form just to add the expertise of an expert.
But I'm still curious about that edit with form tab.
Do you recommend never using more than 2 forms on a page? especially if it is to store data on seperate cargo table ? AjaxDeshayes (talk) 15:21, 27 February 2024 (UTC)Reply
I wouldn't say "never", but I can't think of a case right now where it makes sense to have more than one form for a page. (By the way, a form can handle more than one template - I don't know if you knew that.) Yaron Koren (talk) 16:03, 27 February 2024 (UTC)Reply

"Same as first" or "same as previous" for multi-instance templates[edit]

I think I might have asked this in the past, but I want to achieve a similar effect to the shop websites that have a "Shipping address is same as Billing address" button (though my context is different).

Is it possible to have a button saying "Same as first" or "Same as previous" which auto-populates the relevant template's fields?

Alternatively, is it possible to set the default values for the fields to be the same as the values of the first or the previous template on the page?

Thank you. Jonathan3 (talk) 09:02, 9 March 2024 (UTC)Reply

I would recommend instead having a checkbox with a label like "Shipping address is different from billing address", and then, if the user checks that, use "show on select" to display a 2nd set of address fields. The template could then have some logic to correctly store/display the shipping address. Yaron Koren (talk) 13:47, 11 March 2024 (UTC)Reply
That's a good solution to that problem, but in my context I'd like the fields to be stored in full on the page/template/database for each multi-instance template (rather than have the template work things out). Jonathan3 (talk) 15:33, 11 March 2024 (UTC)Reply
Why - isn't that just redundant data? Yaron Koren (talk) 17:12, 11 March 2024 (UTC)Reply
You're right, of course. I really just need to think of a good way to differentiate between someone leaving a blank field as meaning "I don't know" or meaning "Same as first". Maybe just insist on the form that "blank means unknown so please type Same if you do know". Jonathan3 (talk) 19:34, 11 March 2024 (UTC)Reply
Well, in the case you presented, you could have, instead of the checkbox, a radiobutton with the three options being "Shipping address is the same", "Shipping address is different", and "I don't know the shipping address". Yaron Koren (talk) 20:45, 11 March 2024 (UTC)Reply

Change "No data" text when empty multi-instance template minimised[edit]

I'd like to change this text but when using uselang=qqx it still shows as "No data". How could I change this? Thanks. Jonathan3 (talk) 22:46, 9 March 2024 (UTC)Reply

Just seen where it comes from:

libs/PageForms.js:1140: valuesStr = 'No data';

		if ( valuesStr === '' ) {
			valuesStr = '<em>No data</em>';
		}

Jonathan3 (talk) 22:36, 10 March 2024 (UTC)Reply

That's text that should have been i18n'ed a long time ago - thanks for pointing it out. I just turned it into an i18n message, here. Yaron Koren (talk) 19:08, 11 March 2024 (UTC)Reply

Make top value of "tree" input type unselectable[edit]

I'd like to have something like

structure=*Unselectable A
**Option 1
**Option 2
*Unselectable B
**Option 3
**Option 4

I guess it should be possible with CSS but haven't been able to work it out yet. Thanks. Jonathan3 (talk) 23:17, 10 March 2024 (UTC)Reply

There is a Phabricator task for this - T162574. Yaron Koren (talk) 13:56, 11 March 2024 (UTC)Reply
I worked out how to do this with CSS. The downside is that it relies on numerical ID properties so the CSS might have to change when the options change. Would there be any way of Cargo adding IDs that are linked to the text of the options themselves? Jonathan3 (talk) 16:51, 15 March 2024 (UTC)Reply
Great. Do you mean Page Forms? I don't think so. Yaron Koren (talk) 17:25, 15 March 2024 (UTC)Reply

Hide section headings if sections are empty[edit]

Is this possible? Thanks. Jonathan3 (talk) 16:48, 15 March 2024 (UTC)Reply

Are you talking about actual section headers, with the "=="? If it's possible, it would be outside of the scope of Page Forms. Yaron Koren (talk) 17:23, 15 March 2024 (UTC)Reply

Multi-instance templates - make first different from subsequent[edit]

I don't think this is possible but just checking. I was wondering about keeping all the fields in the same order but removing guidance text. Jonathan3 (talk) 16:54, 15 March 2024 (UTC)Reply

I'm not sure what you mean by "guidance text", but Page Forms doesn't provide that capability. Yaron Koren (talk) 17:24, 15 March 2024 (UTC)Reply
I just meant text that guides people on what data to enter. Thanks for the reply. Jonathan3 (talk) 19:38, 18 March 2024 (UTC)Reply