?
avatar Bakual
Bakual
3 Nov 2016

Steps to reproduce the issue

Create a field with the type "list".
Create some options for it. Eg
options

Expected result

A list with the created options, showing the name part

Actual result

A list with the created options, showing the name part for the first option and the value for the remaining.
list

Additional comments

There is also an issue with the default value which seems to have to match the "name" part and not the "value". So in the example above I would have to enter "Three" as the default value for it to work. Which obviously would be wrong.

avatar Bakual Bakual - open - 3 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 3 Nov 2016
Labels Added: ?
avatar laoneo
laoneo - comment - 3 Nov 2016

You need to put them the opposite. The labels have been different but on some point we changed them to what we have now.

@brianteeman we were discussing this already. Can't find the issue.

avatar Bakual
Bakual - comment - 3 Nov 2016

You need to put them the opposite. The labels have been different but on some point we changed them to what we have now.

That is crazy if you ask me. The value should be the value attribute of the option as it appears in HTML (<option value="0">Foo</option>) and the "name" (or better "text"?) would be the user friendly name/text of the option.

There is still an issue that when the "Name" is 0, the "value" is used instead. But that seems to be an issue of the list formfield itself.

avatar laoneo
laoneo - comment - 3 Nov 2016

Make PR how you would label them.

avatar Bakual
Bakual - comment - 3 Nov 2016

If you can give me a hint where the code is, I can do it. I haven't looked that deep into where those are generated.

avatar laoneo
laoneo - comment - 3 Nov 2016

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/parameters/list.xml

Don't forget to adapt checkboxes and radios when you change something in the XML structure and not just the labels.

avatar brianteeman
brianteeman - comment - 3 Nov 2016

I agree with Thomas


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12725.

avatar brianteeman
brianteeman - comment - 3 Nov 2016
avatar laoneo
laoneo - comment - 3 Nov 2016

Exactly, perhaps we need also the opinion of @coolcat-creations .

avatar brianteeman brianteeman - change - 3 Nov 2016
Status New Confirmed
avatar brianteeman brianteeman - change - 3 Nov 2016
Category com_fields
avatar ggppdk
ggppdk - comment - 3 Nov 2016

@Bakual

If you can give me a hint where the code is, I can do it. I haven't looked that deep into where those are generated.

It is not the XML file it is method JFormAbstractlist::getOptionsFromField that is doing the reversing for both cases of editing (form), and viewing

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/abstractlist.php#L178-L181

            foreach ($options->value as $index => $key)
            {
                $data[$key] = $options->name[$index];
            }

Also method JFormAbstractlist::getOptionsFromField , expects name="name", but radio and checkboxes are using name="key" thus they do not show in the form

I have made a PR,

  • also i noticed that value: 0 is usable in the form but not showing in frontend when viewing the field values, it seems that it is consider as no value, we need to use strlen() somewhere
avatar Bakual
Bakual - comment - 3 Nov 2016

@ggppdk Thanks, just came to the same conclusion as well. I did the code a bit different but in the end it would do the same.
Closing here as we have a PR: #12739

avatar Bakual Bakual - change - 3 Nov 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-11-03 20:30:18
Closed_By Bakual
avatar Bakual Bakual - close - 3 Nov 2016

Add a Comment

Login with GitHub to post a comment