Pergunta

I'm receiving data in the following format from a multi-checkbox

["Ethnicity"]=> array(3) { ["Maori"]=> string(5) "Maori" ["Pacific Peoples"]=> string(15) "Pacific Peoples" ["Other European"]=> string(14) "Other European" }

I'm trying to get this into a multi-checkbox in Jira via an API call using the following segment

'customfield_11337' => [
 "value" => $data["Ethnicity"]
],

But this returns an error string(21) "data was not an array"

So I've tried to massage the data into a single array using

$ethnicityArray = array();
    foreach ($data["Ethnicity"] as $eth => $value) {
        array_push($ethnicityArray, $value);

}

But this returns the same error. I should note that I've got no problem populating radio buttons, text fields etc in Jira via the same method. It just seems to be checkboxes I can't get right.

How do I go about solving this using PHP?

Foi útil?

Solução

The correct solution was to get the data into a format that looks like:

'customfield_11333' => [["value" => "Asian"], ["value" => "Other"]]
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top