Page MenuHomePhabricator

Page Forms: Checkboxes labels in multiple-instance templates are not clickable
Closed, ResolvedPublic

Assigned To
Authored By
Mar 3 2019, 5:07 PM
Referenced Files
F31676554: checkboxes.PNG
Mar 11 2020, 3:19 PM
F31676472: editingUsingSchema.PNG
Mar 11 2020, 1:50 PM
F31676476: createtrial232.PNG
Mar 11 2020, 1:50 PM
F31672811: editingPageForms.PNG
Mar 9 2020, 1:10 PM
F31672804: pageFormsCreate.PNG
Mar 9 2020, 1:10 PM
F31672808: formresult.PNG
Mar 9 2020, 1:10 PM
F31606584: manual guide.png
Feb 10 2020, 8:59 AM
F31606189: Create Special.png
Feb 10 2020, 5:15 AM


If there's an input of type "checkboxes" within a multiple-instance template, the labels for the individual values are not clickable - clicking on them won't check/uncheck the boxes - even though they have a <label> tag around them. I believe that's due to this change I made to PageForms.js (then known as SemanticForms.js):

This code ends up adding a "for" attribute to all "label" tags within a multiple-instance template - even ones that are not supposed to have them - which messes up their behavior. So the JS code needs to be modified to only change the "for" value for labels that already have a "for" value.

Event Timeline

@Yaron_Koren, In case of multiple-instance templates even the other inputs (of type text etc) are also not getting highlighted when clicked on their respective labels.

@Rammanojpotla - ah! I never thought to test those. It's not surprising that those are failing too. Good to know, though.

I tried solving this issue. Initially, I was able to reproduce the error and worked it out. But after I updated my local repo to the latest commit. Whenever I try to add an instance it logs an error in the console saying

image.png (145×898 px, 23 KB)

Currently, I am unable to reproduce the issue, even after installing the extension named TinyMCE I am getting the same error. Are you able to add an instance?

Sorry about that - that was a bug added a few weeks ago, which I forgot to check in a fix for earlier. I just checked in a fix.

Change 494494 had a related patch set uploaded (by Rammanoj; owner: rammanoj):
[mediawiki/extensions/PageForms@master] Add highlight input when labels clicked

Change 494494 abandoned by Yaron Koren:
Add highlight input when labels clicked

Hello @Yaron_Koren is this still an issue? If so, please how do I experience the bug? thanks. I already have cargo and page forms extensions enabled, and I am able to create pages using pageforms

CreateForm.png (550×1 px, 84 KB)

Yes, this is still an issue. You need to specify "input type=checkboxes" for at least one field in the form.

When Creating form fields using Special:CreateClass I don't see an option for field type checkboxes, I only see Page, String, Text, Integer, Float, Date etc

Right, those are Cargo field types, which are different from Page Forms input types. You can't directly specify an input type in Special:CreateClass, unfortunately. But actually, if in Special:CreateClass you click on the "List of values?" checkbox and add a set of values to the "Allowed values" input for any one field, I think checkboxes will show up for that field in the resulting form.

So I tried Specifying List of Values, But the form created, did not have checkboxes, rather it had Textfields, Here is a how I filled the Special:CreateClass options

Create Special.png (306×1 px, 30 KB)

Also How do I access the Pageform input types directly without going through Cargo?

The type specified might need to be "String".

You can change the input type by going to the form definition and editing it manually.

Changed it to String, still the same output, I tried editing it manually using form edit and the previews don't include any checkboxes,

manual guide.png (207×732 px, 10 KB)

Is there any link or guide to get it done? Maybe you could help me create one, I don't mind getting feedback after some days, thanks.

Hello, @Yaron_Koren does this issue still exist? If yes, I have been trying to experience this issue from what I learned from your discussion with Prondubuisi and what I understood from the documentation so far. But, I am still stuck. could you please give me any pointers or hints? thanks in advance.

@AdhamKhatean - yes, it still exists. Have you tried creating a form with the Page Forms extension?

@Yaron_Koren - I have created a page using the form I created through "Special:CreateClass"

pageFormsCreate.PNG (165×770 px, 7 KB)

, and I checked "List of values?" and added several options for every field. But, what I got was a form with text boxes instead of checkboxes.
formresult.PNG (501×1 px, 13 KB)

So, I tried to edit it manually but have not noticed any change.
editingPageForms.PNG (188×403 px, 5 KB)

The "input type=checkboxes" needs to go into the form definition (a wiki page whose name starts with "Form:").

@Yaron_Koren - I created a new form using PageSchemas then edited its definition manually,

editingUsingSchema.PNG (472×1 px, 27 KB)

But, I did not get checkboxes of the list of values I added or any other input type. Instead this is what happened.
createtrial232.PNG (477×1 px, 15 KB)

could you please tell me what is wrong with what I did or direct me to where can I learn more preferably with code example(s).

@Yaron_Koren - Thank you now it works perfectly

checkboxes.PNG (497×1 px, 20 KB)
but it does check/uncheck even if I click on the label

That's right, yes - as the bug description notes, this problem only occurs when the checkboxes are part of a multiple-instance template.

Change 579801 had a related patch set uploaded (by AdhamKhatean; owner: AdhamKhatean):
[mediawiki/extensions/PageForms@master] Fix the problem of Label clicking does not affect checkbox

@Yaron_Koren - Kindly, check if any changes need to be done on this contribution I11b6a1b32de5adb5a030c2b31f53feb66cc4bda9
Thanks in advance.

Change 579801 merged by jenkins-bot:
[mediawiki/extensions/PageForms@master] Fix the problem of Label clicking does not affect checkboxes

Yaron_Koren claimed this task.

Fixed now! @AdhamKhatean - thank you!