Create a field with the type "list".
Create some options for it. Eg
A list with the created options, showing the name part
A list with the created options, showing the name part for the first option and the value for the remaining.
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.
Labels |
Added:
?
|
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.
Make PR how you would label them.
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.
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.
I agree with Thomas
@laoneo are you referring to joomla-projects/custom-fields#121
Exactly, perhaps we need also the opinion of @coolcat-creations .
Status | New | ⇒ | Confirmed |
Category | ⇒ | com_fields |
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,
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-11-03 20:30:18 |
Closed_By | ⇒ | Bakual |
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.