GSoC Biweekly Report-02

Yash Varshney
2 min readJul 14, 2021

In the first report, I discussed the two forms of autocompletion present in PageForms, i.e., “values from category” and “cargo field.” In this report, I’ll talk about the autocompletion forms: “values dependent on” and “values from external data”. If you haven’t read the first report, you can find it here. These two autocompletion are very similar to the other. The autocompletion with external data is achieved with the help of External Data Extension; one needs to define the variable for external data properly inside the form definition, and using that definition the autocompletion is enabled inside the spreadsheet, the autocompletion with dependent fields can be simplified by an example: Suppose that you have two fields defined-one is country and the other is a city. You have chosen the country India and city as Delhi and saved the page. Now you create another page and enable the “values dependent on” autocompletion with the source field as Country. If you enter the country's value again as India and now fill the value of the city, then the autocomplete options will show Delhi as one of its components. This is what dependent means, the field “city” is dependent on the value of field “country”. The form-definition components about the autocompletion are obtained with the help of the object of the class PFTemplateInForm. The sample form definitions for both types of autocompletion are:

{{{for template|Books|multiple|display=spreadsheet}}}
{| class=”formtable”
! Title:
| {{{field|Title}}}
|-
! Genre:
| {{{field|Genre|values dependent on=Books[Title]}}}
|-
! Name:
| {{{field|Name}}}
|-
! Class:
| {{{field|Class}}}
|}
{{{end template}}}

{{{for template|Countries|multiple|display=spreadsheet}}}{{#get_web_data:url=https://discoursedb.org/GermanyCSV.txt|format=csv with header|data=bordered countries=Borders,population=Population,area=Area,capital=Capital}}
The following data has been retrieved from
http://discoursedb.org/GermanyCSV.txt, using the [http://www.mediawiki.org/wiki/Extension:External_Data External Data] extension:

*Germany borders the following countries: {{#arraymap:{{#external_value:bordered countries}}|,|x|[[x]]}}.
* Germany has population {{#external_value:population}}.
* Germany has area {{#external_value:area}}.
* Its capital is {{#external_value:capital}}.

{| class=”formtable”
! Title:
| {{{field|Country|values from external data=
bordered countries}}}
|-
! Genre:
| {{{field|Genre|values from external data=
area}}}
|}
{{{end template}}}

And of course they support the settings $wgPageFormsAutocompleteOnAllChars. In the next report, I’ll talk about some more forms of autocompletion like- “values from property” and “values from concept”, etc. We will also look at the autocompletion inside Special: MultiPageEdit and most possibly wind up the project.

--

--