Simple select list not accepting value.
Watchdog: Illegal choice in "BU" element.
Warning: Illegal offset type in isset or empty in list_field_validate() (line 394 of /modules/field/modules/list/list.module).

The web service is calling in JSON:

{
  "type":"TEST",
  "title":"TITLE",
"uid":"1",
  "field_mosaic_bu":{ "und": [{"value":"bu name"}] },
  "field_mosaic_var1":{ "und": [{ "value":"test1" }] },
  "field_mosaic_var2":{ "und": [{ "value":"test2" }] },
  "field_mosaic_var3":{ "und": [{ "value":"test3" }] },
  "field_mosaic_image":{ "und": [{ "fid":"4" }] }  
}

The issue is coming from "field_mosaic_bu" which is a Select list. "bu name" is a correct value.
If I put a plain textfield, it works fine.

Any help would be much appreciated.

This post http://drupal.org/node/1144236 seems to be a similar probleme, but not only contained for select lists.

Comments

marcingy’s picture

Category: bug » support
Priority: Major » Normal
Teebo’s picture

For those of you who will probably have the same problem, here is the correct way to handle LIST type fields (in ex. below field_mosaic_bu):

{
  "type":"TEST",
  "title":"TITLE",
  "uid":"1",
  "field_mosaic_bu":{ "und": ["bu name"] },
  "field_mosaic_var1":{ "und": [{ "value":"test1" }] },
  "field_mosaic_var2":{ "und": [{ "value":"test2" }] },
  "field_mosaic_var3":{ "und": [{ "value":"test3" }] },
  "field_mosaic_image":{ "und": [{ "fid":"4" }] }  
}

Hope this helps someone. Took me a lot of time to figure this out.

marcingy’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Kartagis’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Sorry for butting on this, but I've got the same issue, only with checkboxes. Has anyone found a solution for this? In case anyone is interested, here is my question on Drupal Answers.