No Code Attached Yet
avatar antonbag
antonbag
12 Sep 2022

Steps to reproduce the issue

1)Create a Content Field of type List called "mylistfield" (for example) with values and activate the multiple option.
1)Create an Article and in the Fields Tab, enter two values in "mylistfield".
1)Call with the API to the created ID article {{base_url}}/{{base_path}}/content/articles/{{your article id}} with Postman

Expected result

The field shows two values:
"mylistfield": [
{
"value": "Value 1",
"alias": "value-1"
},
{
"value": "Value 2",
"alias": "value-2"
},
],

Actual result

            "mylistfield": []

System information (as much as possible)

Joomla 4.2.2
Php 7.4

Additional comments

This code should work. I am not sure if it should be plain or associative array.

    $api_values = array();
    foreach ($field->rawvalue as $value) {
        if (isset($options[$value])) {
            //$api_values[$value => $options[$value]];
            $api_values[] = array(
                'value' => $options[$value],
                'alias' => $value
            );             
        }
    }

    $field->apivalue = $api_values;
avatar antonbag antonbag - open - 12 Sep 2022
avatar joomla-cms-bot joomla-cms-bot - change - 12 Sep 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Sep 2022
avatar antonbag antonbag - change - 12 Sep 2022
Title
multiple fields in webservice doesnt work
custom fields List with multiple values doesn't work in Webservice
avatar antonbag antonbag - edited - 12 Sep 2022
avatar antonbag antonbag - change - 12 Sep 2022
The description was changed
avatar antonbag antonbag - edited - 12 Sep 2022
avatar richard67 richard67 - close - 12 Sep 2022
avatar richard67
richard67 - comment - 12 Sep 2022

Closing as there is a pull request which claims to solve this issue. See #38744 .

avatar richard67 richard67 - change - 12 Sep 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-09-12 19:16:25
Closed_By richard67

Add a Comment

Login with GitHub to post a comment