Page MenuHomePhabricator

values from namespace does not save the prefixed namespace but only the value
Closed, InvalidPublicBUG REPORT

Description

Mediawiki version: 1.34.1
Page Forms version: 4.9.3

Steps to Reproduce,

Create a form with input field:

field|inputfield|input type=tokens|values from namespace=namespace

Actual Results:

Value written to template as

|inputfield=Value

Expected Results:

|inputfield=namespaceprefix:Value

values from category has the behaviour described in expected results.

I tried to add

...|namespace=namespace

but noticed that it didn't change the namespace, as mentioned in https://phabricator.wikimedia.org/T250759

Event Timeline

Oeyvindg renamed this task from values from namespace does not contain the prefixed namespace to values from namespace does not save the prefixed namespace but only the value.Jun 5 2020, 7:47 PM

Hi @Oeyvindg, thanks for taking the time to report this! Please always include MediaWiki and Page Forms version information - thanks!

Thank you @Aklapper, added to description.

@Oeyvindg - yes, that behavior is on purpose. The idea is that this gives the form/template designer more flexibility - because then they can have the template add the namespace prefix to the value (or values, using #arraymap), or not. An obvious example is if the field holds a file name. The template could then display that value as:

[[File:{{{TheFile|}}}|{{{TheFile|}}}]]

Is the differing behavior then on purpose in regards to the other autocompletes, like category and (SMW) property (I Did not check the behaviour here)? I.E if you are autocompleting on a category, you most likely want the namespace prepended, but if you autocomplete on namespace, there are other use cases?

I see I'm mostly thinking of how things work from my semantic/RDF centric data view.

Yes, it's different on purpose. With anything other than "values from namespace", the values returned can be in different namespaces - so the page names have to contain the namespace. It's a little confusing, but I think this is the best solution.

Thank you Yaron. I've now used the #arraymap parser function to re-add the the namespace for my use case.

It works as expected from LUA

mw.getCurrentFrame():callParserFunction(  '#arraymap', value, sep, 'x', namespace .. ':x', sep )