Page MenuHomePhabricator

[SF][2.8] mapping template not working with input types tokens, combobox
Closed, ResolvedPublic

Description

Mapping Templates works fine for me with input type=dropdown but fails with input
type=tokens or input type=combobox.

This is an issue, as tokens and combobox are required for multivalue fields.


Version: unspecified
Severity: major

Details

Reference
bz73641

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:56 AM
bzimport set Reference to bz73641.

A fix has been proposed that makes mapping template work correctly with input types tokens and combobox: https://gerrit.wikimedia.org/r/#/c/176505/.

Note that comboboxes only work for single values fields, however (https://www.mediawiki.org/wiki/Extension:Semantic_Forms/Defining_forms#Combobox_input), so you will need to use tokens or listbox if you want to select multiple values.

cicalese set Security to None.

I'm using SF 3.0 (SMW 1.9, MW 1.22) and the mapping template still does not work with such input types as "combobox", "tokens" or "text with autocomplete". This may be due to certain issues with "combobox" and "tokens", because in some cases they autocomplete on the wrong category.

(I'm presuming that the template name to be provided after "mapping template=" is without the namespace prefix, but specifying it makes no difference.)

Even "dropdown" itself is a little awkward. A query set by the mapping template is prefixed with "<!-- LINK 0:1 -->" and onwards and placed between rounded brackets, while italics and other such html code are not rendered.

Field definitions of the form below work correctly for me with SF 3.0, SMW 1.9.2, MW 1.23:

{{{field|field1|input type=dropdown|values from category=Items|mapping template=Name Map}}}
{{{field|field2|input type=listbox|values from category=Items|mapping template=Name Map}}}
{{{field|field3|input type=radiobutton|values from category=Items|mapping template=Name Map|mandatory}}}
{{{field|field4|input type=checkboxes|values from category=Items|mapping template=Name Map}}}
{{{field|field5|input type=combobox|existing values only|values from category=Items|mapping template=Name Map}}}
{{{field|field6|input type=tokens|existing values only|values from category=Items|mapping template=Name Map}}}

where Template:Name Map is defined as follows:

{{#show:{{{1}}}|?Name}}

and a property Name defined to be of type Text exists on the pages in question.

Note that I have not tested "text with autocomplete" and I have only tested "combobox" and "tokens" with "existing values only". Further, HTML in the mapping template is not supported.

Text in parentheses at the end of the labels returned from the mapping template indicates that the mapping template returns identical text for two or more pages in the set.

Thanks Cicalese for your speedy reply!

After some further trial and error, I'm finally getting results and may have found the root of the bug: unfortunately, "mapping template" does not, as yet, appear to work in combination with "remote autocompletion", which I do need because of the number of pages contained in a particular category. If this is true, then would a feature request be acceptable?

{{#show:{{{1}}}|?Name}}

Text in parentheses at the end of the labels returned from the

mapping template indicates that the mapping template returns identical
text for two or more pages in the set.

I tend to use {{{1|}}} myself, with the pipe included, but I've now followed your approach. I wonder if the pipe was causing the strange bits of syntax to appear.

P.S. As for "wrong category", ignore this for now. This feature was
behaving differently when I tried to create a simpler test case
(in order to remove any fuzz that might be interfering), but I'm beginning to doubt if that was the right approach.

Best,

Cav

Ah, yes, you are correct. The mapping template functionality does not currently work with remote autocompletion. We decided to defer this due to complexity that it introduces, waiting to see if there is a need for this functionality. Could you please create a separate task for this, and I will revisit this when I get a chance?

I checked, and the Name Map template works fine with {{{1|}}} in place of {{{1}}}. Something else must have been going on to cause the extra characters. If you see it again, feel free to let me know.

Thanks,

Cindy

Task created: T86959

Date: Thu, 15 Jan 2015 15:31:20 +0000
To: contrafibularity@hotmail.com
From: no-reply@phabricator.wikimedia.org
Subject: [Maniphest] [Commented On] T75641: [SF][2.8] mapping template not working with input types tokens, combobox

cicalese added a comment.

Ah, yes, you are correct. The mapping template functionality does not currently work with remote autocompletion. We decided to defer this due to complexity that it introduces, waiting to see if there is a need for this functionality. Could you please create a separate task for this, and I will revisit this when I get a chance?

I checked, and the Name Map template works fine with {{{1|}}} in place of {{{1}}}. Something else must have been going on to cause the extra characters. If you see it again, feel free to let me know.

Thanks,

Cindy

TASK DETAIL

https://phabricator.wikimedia.org/T75641

REPLY HANDLER ACTIONS

Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.

EMAIL PREFERENCES

https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Yaron_Koren, cicalese
Cc: planetenxin, cicalese, Cavila, Yaron_Koren, Foxtrott