Setting a Menu Value in Connect for PHP
Content
This is making me crazy, but I don't seem to be able to set a value on a menu field in a custom object using CPHP. On a test site, I built a custom object called "Animal" with two fields: "Name" is a string, and "Sound" is a menu with the values "Moo" (0), "Oink" (1), "Woof" (2). (See attached code block.) I cannot set either
$animal->Sound->ID = 2;
or
$animal->Sound->LookupName = 'Woof';
Because I get an error similar to "Connect error: 1, Not Allowed: read-only; AnimalSounds.ID" Buuut...I'm pretty sure I'm following the example in the documentation found on this page
Tagged:
0