Page MenuHomePhabricator

Combobox field inside multy template convert value to 0 while editing
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

When adding values to combobox field, saving the form, then edits the form again, the value replaced with 0
Here's minimal wikitext to check this

<noinclude>
    This form is being used to create my_page pages for use as Main pages in our system
    {{#forminput:form={{PAGENAME}}|button text=Create my page|placeholder=Page name}}
    
    </noinclude>
    <includeonly>
    <div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
==Page==
    {{{for template|my_page}}}
   
    {{{field|parts 1|holds template}}}
   
    

 
    {{{end template}}}
    {{{for template|part 1|multiple|add button text=Add part|embed in field=my_page[parts 1]|display=table}}}
    {{{field|title_section|input type=combobox|label=part title (can be the target page name)|values from namespace=Main}}}
    {{{field|subtitle|label=part content}}}
    {{{end template}}}
    __NOTOC__ __NOEDITSECTION__
  • create form with this wikitext
  • create page with this form, add value to one or more section_title fields.
  • Save it.
  • Check in ?action=edit - value is OK
  • Edit the page with the form.
  • You dont have to change something
  • Save it
  • Check in ?action=edit
  • section_title=0

What happens?:

value is becoming 0

What should have happened instead?:

value presists

Software version :

Other information
The data I've mange to grab:

  • this is PHP bug: the source code of HTML rendering input with value="0"
  • while editing the page with the form (second time) $cur_value of the problematic field, for example in PFFormPrinter::formHTML is an array of [0 => 'FIELD_VALUE']. I don't have enough knowledge if this as intended or not.
  • If I'm understanding well, this is part of $gridValues var

Event Timeline

Anysite updated Other Assignee, added: Yaron_Koren.
Anysite updated Other Assignee, removed: Yaron_Koren.
Anysite added a subscriber: Yaron_Koren.

Change #1032825 had a related patch set uploaded (by Yaron Koren; author: Yaron Koren):

[mediawiki/extensions/PageForms@master] Fix autocomplete with "values from namespace=Main"

https://gerrit.wikimedia.org/r/1032825

Change #1032825 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] Fix autocomplete with "values from namespace=Main"

https://gerrit.wikimedia.org/r/1032825

I was able to reproduce this problem, but it turned out to be not due to the multiple-instance template but to "values from namespace=Main"! At least, that's how it appeared to me. I just checked in what I think is a fix - please let me know if this fixes the problem for you.

Yaron_Koren claimed this task.

I'm closing this, because I think it's fixed... feel free to re-open if not.