Page MenuHomePhabricator

Special:CreateForm should use labels, not field names, from templates as its label values
Open, Needs TriagePublic



The canonical tutorial for Page Forms is the Books example in the Page Forms Quick Start Guide (PFQSG). It is unfortunately currently (as of 8 Dec 2016) broken (though not seriously, as with the previous bug), in that

  1. Form:Book (or its localized equivalent--see below section=replication on sandbox.SMW) does not present for input as defined in Template:Book. (For details, see procedure step=4.1.)
    1. field=Authors has label=Authors not Author(s)
    2. field=Genres has label=Genres not Genre(s)

Note however that Books, once created, that are presented using that form show the correct field labels.

choice of replication site

As of 8 Dec 2016, this breakage has been reproduced only on Referata at this site. This is because sandbox.SMW is currently still on Page Forms 4.0.2 commitID=7b95a65 (per its Spécial:Version which unfortunately cannot be archived due to its robots.txt), and that version remains vulnerable to the older version of this bug. By contrast, Referata currently has Page Forms 4.0.2 commitID=b071fb1, which fixes the older and more serious bugs with the PFQSG example.

replication on Referata

The following replication procedure is adapted (for greater exactness and speed of replication) from the Books example.

1. Create a new test wiki. I used for my testrun, and links below are in that domain.

2. Create properties with [[|Special:CreateProperty]]:

2.1. [[|name=Was written by]], type=Page
2.2. [[|name=Has genre]], type=Text, allowed values=Art,Cookbook,Fiction,History,Poetry,Science
2.3. [[|name=Was published in year]], type=Number
2.4. [[|name=Has number of pages]], type=Number
2.5. [[|name=Is from country]], type=Text

3. Create templates with [[|Special:CreateTemplate]]:

3.1. Create template=Book (not linked here due to subsequent edit):

3.1.1. Set template name=Book, set to define category=Books
3.1.2. 1st field: set name=Authors, the label=Author(s), semantic property=Was written by, check box allowing field to hold a list of values, click button=Add field
3.1.3. 2nd field: set name=Genres, label=Genre(s), semantic property=Has genre, check box to allow list of values, click button=Add field
3.1.4. 3rd field: set name=Year, label=Year of publication, semantic property=Was published in year, click button=Add field
3.1.5. 4th field: set name=Number of pages, label=Number of pages, semantic property=Has number of pages
3.1.6. Click button=Save page

3.2. Create [[|template=Author]]

3.2.1. Set template name=Author, set to define category=Authors
3.2.2. 1st field: set name=Country, the label=Country of origin, semantic property=Is from country
3.2.3. In section=Aggregation, set Semantic property=Was written by , Title for list=Books by this author
3.2.4. Click button=Save page

4. Create forms with [[|Special:CreateForm]]:

4.1. Create [[|form=Book]]

4.1.1. Set form name=Book, set template name=Book, click button=Add
4.1.2. Note form's presentation mismatches settings made above to Template:Book:

  1. field=Authors has label=Authors not Author(s)
  2. field=Genres has label=Genres not Genre(s)

4.1.3. Click button=Save page

4.2. [[|Create form=Author]]

4.2.1. Set form name=Author, set template name=Author, click button=Add
4.2.2. Click button=Save page

5. Create categories with [[|Special:CreateCategory]]:

5.1. Create [[|category=Books]]

5.1.1. Set category name=Books, set form name=Book, click button=Save page

5.2. Create [[|category=Authors]]

5.2.1. Set category name=Authors, set form name=Author, click button=Save page

6. Edit Template:Book to enable redlinking to forms:

6.1. In editing area, find text=

{{#arraymap:{{{Authors|}}}|,|x|[[Was written by::x]]}}

6.2. Replace with text=

6.3. Click button=Save page

7. Create data using forms:

7.1. Create Book using Form:Book

7.1.1. Set page title=The Quiet American, click button=Create or edit
7.1.2. In subsequent form UI, note same presentation problems as previous:

  1. authors field has label=Authors not Author(s)
  2. genres field has label=Genres not Genre(s)

7.1.3. Set author=Graham Greene, check box for genre=Fiction, year=1955, pages=123, free text=

One of the great short novels, as well as one of the great novels of war.

7.1.4. Click button=Save page. Note that the resulting/created Book correctly

  • presents (for output, not input) using the correct field labels, as set in Template:Book
  • has a redlink for its author

7.2. From the resulting Book, create its Author by right-clicking on the redlink. In the resulting form UI,

7.2.1. Set author country=Britain, free text=

A giant of 20th-century literature.

7.2.2. Click button=Save page.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

It seems like the problem you're describing is that Special:CreateForm uses as its default value for the "label" the field name from the template, not the label from the template. Is that correct?

Yaron_Koren renamed this task from PFQSG Books example: Form:Book (for input only): wrong field labels to Special:CreateForm should use labels, not field names, from templates as its label values.Dec 21 2016, 9:00 PM

I renamed this bug based on my guess of what it's talking about.