Post

3 followers Follow
1
Avatar

Rearranging Options in a Category Field

Hello!

I'm trying to rearrange the options in a category field, but am receiving a Fatal Error when I try to do so. Example code below.

The arrangement of the id's doesn't seem to be an issue, since rearranging the options manually in Edit Template produces the same result (where position 0 has text C and id 3).

$Field_Original = {
"0": {"status": "active", "text": "A", "id": 1, "color": "DCEBD8"},
"1": {"status": "active", "text": "B", "id": 2, "color": "DCEBD8"},
"2": {"status": "active", "text": "C", "id": 3, "color": "DCEBD8"}
}
$Field_Update = {
"0": {"status": "active", "text": "C", "id": 3, "color": "DCEBD8"},
"1": {"status": "active", "text": "A", "id": 1, "color": "DCEBD8"},
"2": {"status": "active", "text": "B", "id": 2, "color": "DCEBD8"}
}
$FieldAttributes = array (
'label' => $Field_Label,
'required' => $Field_Required,
'delta' => $Field_Delta,
'settings' => [
'multiple' => $Field_Multiple,
'display' => $Field_Display,
'options' => $Field_Update
]);
PodioAppField::update($AppID, $FieldID, $FieldAttributes);
Ashwin Malik

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Ashwin,

can you please copy/paste the error in here so that we may dig a little bit deeper in the issue?


Domenico Matteo 0 votes
0
Avatar

Domenico, here's an example error I receive.

 

Fatal error: Uncaught PodioBadRequestError: "Invalid value {
"11": {"status": "deleted", "text": "Zeeem", "id": 11, "color": "DCEBD8"},
"10": {"status": "deleted", "text": "Zoom", "id": 10, "color": "DCEBD8"},
"13": {"status": "active", "text": "aaaaaa", "id": 13, "color": "DCEBD8"},
"12": {"status": "active", "text": "ZZZZ", "id": 12, "color": "DCEBD8"},
"14": {"status": "active", "text": "CHOCO", "id": 14, "color": "DCEBD8"},
"1": {"status": "active", "text": "Flip", "id": 1, "color": "DCEBD8"},
"0": {"status": "active", "text": "Flep", "id": 5, "color": "DCEBD8"},
"3": {"status": "active", "text": "Flap", "id": 3, "color": "DCEBD8"},
"2": {"status": "active", "text": "Flop", "id": 2, "color": "DCEBD8"},
"5": {"status": "active", "text": "Flooor", "id": 6, "color": "DCEBD8"},
"4": {"status": "active", "text": "Flup", "id": 4, "color": "DCEBD8"},
"7": {"status": "deleted", "text": "Freeeop", "id": 7, "color": "DCEBD8"},
"6": {"status": "active", "text": "MALE", "id": 15, "color": "DCEBD8"},
"9": {"status": "deleted", "tex
in /home/multiplytech/public_html/xyz.com/podio/lib/Podio.php on line 252
Ashwin Malik 0 votes
0
Avatar

Hi Ashwin, 

a stacktrace would be very helpful, since I can't really get a lot of info from a generic InvalidValue

Domenico Matteo 0 votes