Page MenuHomePhabricator

HTML attribute value can not contain a list of values
Open, Needs TriagePublic

Description

Hello Yaron,

I'm getting this error as of SF 3.5:

HTML attribute value can not contain a list of values

2016-03-03 15_03_12-Bearbeite Process Step_ Process_Step_Raumanfrage absagen – HLA Hameln - Firefox .png (1,161×520 px, 17 KB)

This seems to be caused by a comma in template parameter:

{{Responsibilities RSCI
|Responsible=Role:Abteilungsleiterin/-leiter (AL), alle
}}

My guess is, that the error is thrown by some internal MediaWiki HTML/Wikitext validator. So the error should be where SF generates the Form Edit HTML.

I'm generally using ; as a delimiter, but those settings seem to have no effect on this problem.

On SF 3.4.1 it works fine, on SF 3.4.2 the form is rendered, but I get this error message:

Notice: Undefined variable: delimiter in /var/www/kam-bbs.wiki/wiki-hlahm/extensions/SemanticForms/includes/SF_FormPrinter.php on line 911

Related Objects

Event Timeline

If you change line 927 of /includes/SF_FormPrinter.php from:

$delimiter = ',';

...to:

$delimiter = '';

...does that have any effect on this error?

Yes, that solves the problem!

This diff fixes the delimiter and also fixes the radiobutton issue with value/label distinction:

index 922bb8c..dbcf574 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -815,7 +815,7 @@ END;
                                                        // the fields that weren't
                                                        // handled by the form.
                                                        $cur_value = $tif->getAndRemoveValueFromPageForField( $field_name );
-
+
                                                        // If the field is a placeholder, the contents of this template
                                                        // parameter should be treated as elements parsed by an another
                                                        // multiple template form.
@@ -924,7 +924,7 @@ END;
                                                                $form_field->hasFieldArg( 'mapping cargo field' ) ) ) ) {
                                                                // Avoid a PHP notice.
                                                                if ( !is_array( $cur_value ) ) {
-                                                                       $delimiter = ',';
+                                                                       $delimiter = ';';
                                                                }
                                                                $cur_value = SFUtils::valuesToLabels( $cur_value, $delimiter, $form_field->getPossibleValues() );
                                                        }

I didn't notice until now that you had changed the delimiter to a ";", instead of blank - is there an advantage to doing that?

I'm not sure how you handle this internally of SF, but I'm always using ; as separator, as the changes are very low that it will cause issues with page titles

Okay, thanks. I changed the variable to blank in the code; we'll see how well it works. For now, I'm setting this to "Resolved".

A workaround I used was setting delimiter to a different value in my form's field-definition.

Rcdeboer subscribed.

This bug seems to have reappeared in PF 4.3. I'm running Page Forms 4.3.1 and encounter this error message when a comma-separated list of values is used. I've found another report of someone downgrading to 4.2.1 to 'fix' this. (https://github.com/fuerthwiki/wiki/issues/97)

Is it still a problem in PF 4.4?

Good question. Will check that later this week.

Checked and confirmed: it is still a problem in PF4.4.

@Rcdeboer - what's the exact error message you're seeing?

Also, what does the "Responsible" field tag in the form definition look like?

The error is "HTML attribute value can not contain a list of values". As far as I know, there is no 'responsible' field tag in the form definition.

Okay - what does the form definition look like?

Sorry for the very long delay. I just checked in what I think is a fix. I believe this was only ever an issue for the "text with autocomplete" input type (as opposed to "tokens"), which might explain why I never saw this problem myself. Feel free to re-open if this hasn't actually been fixed.

This comment was removed by Joris.
Joris reopened this task as Open.EditedJun 29 2021, 2:42 PM

The issue reappears in this combination:
{{{field|test|list|values from namespace=File}}}
Example: https://sandbox.semantic-mediawiki.org/wiki/Formulaire:T128733

Tested on PF: 4.9.5 & 5.2.1 (01a2363)
Running MW: 1.31.12 & 1.35.0-rc.2 respectively.

Note that the issue appears as soon as you try to save a field containing a separator (comma), or try opening a page with a comma in that field

@Joris I had this too just last week. Just remove the list parameter form the field definition to move on. In this case you can use separators again.

@Joris I had this too just last week. Just remove the list parameter form the field definition to move on. In this case you can use separators again.

That's essentially what I did too, but autocomplete on multiple values would've been nice :)

Aklapper added a subscriber: Yaron_Koren.

Removing task assignee due to inactivity, as this open task has been assigned for more than two years (see emails sent to assignee on May26 and Jun17, and T270544). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be very welcome!

(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

Sorry again for the very long delay. Is this still an issue? If so, what is the input type it's happening for? ("text with autocomplete" no longer exists, since 2020 - it's just an alias.)

Still an issue. The form that Joris linked to (https://sandbox.semantic-mediawiki.net/wiki/Formulaire:T128733) has the following definition :

https://phabricator.wikimedia.org/T128733
<noinclude>{{#forminput:form={{PAGENAME}} }}</noinclude><includeonly>
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|{{PAGENAME}} }}}

;test
:{{{field|test|list|values from namespace=File}}}
{{{end template}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
</includeonly>

If you

  1. create a new page using this form (e.g. https://sandbox.semantic-mediawiki.net/wiki/Sp%C3%A9cial:AjouterDonn%C3%A9es/T128733/Foobar) and then
  2. provide the following list of values: foo, bar, baz ,
  3. previewing the changes (with the 'Show Changes' button) gives the error message "HTML attribute value can not contain a list of values"

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

[mediawiki/extensions/PageForms@master] Fix handling of values in "text" input with "list" specified

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

Change 913215 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] Fix handling of values in "text" input with "list" specified

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

Okay, now I finally got it! Thanks for the explanation. Seven years too late with the fix, but I believe this is fixed now.

Yaron_Koren claimed this task.

Marking this as "Resolved" - feel free to re-open if not.

ErikJB subscribed.

I encountered the error again on MW 1.43.9 and PF 6.0.10 when I create a simple form with

{{{field|test|values from namespace=File}}}

If iI enter anything but an empty String, I get the error

HTML attribute value can not contain a list of values

on save, preview or show changes.

What does the full form definition look like?

<noinclude>
{{#forminput:form=Test}}
</noinclude><includeonly>
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|Test}}}
{| class="formtable"
! Test: 
| {{{field|test|values from namespace=File}}}
|}
{{{end template}}}
{{{standard input|free text|rows=10}}}
</includeonly>

Okay, thanks. Is there a corresponding "Test" template, which contains a "test" field?

Yes, I added it as an MWE:

<noinclude>
{{#template_params:test}}
</noinclude><includeonly>{{{test|}}}</includeonly>

Sorry, I can't reproduce this problem. By the way, that form definition is strange - because there is no input type defined, "values from namespace" will not have any effect - it's just a text input. Or do you something other than a text input there?

Thank you for taking the time to look at the issue! I will have to narrow it down a little more, since I am also seeing it on one of my other Wikis too.

I know that this form definition does not make a lot of sense, I just removed everything for a MWE where the error still occurs. Since I use PF together with Semantic MediaWiki, I do not always explicitely define the input type, since PF derives it automagically from the semantic property of the parameter. Great work by the way, we are huge fans of PageForms here in our group. :-)

Sorry for the delay. And thanks! So what is the input type that you get for that field?

I get a "text" input type. But even if I say

{{{field|test|input type=text|values from namespace=File}}}

the error still occurs.