{"action":"created","issue":{"url":"https://api.github.com/repos/signalpoint/DrupalGap/issues/947","repository_url":"https://api.github.com/repos/signalpoint/DrupalGap","labels_url":"https://api.github.com/repos/signalpoint/DrupalGap/issues/947/labels{/name}","comments_url":"https://api.github.com/repos/signalpoint/DrupalGap/issues/947/comments","events_url":"https://api.github.com/repos/signalpoint/DrupalGap/issues/947/events","html_url":"https://github.com/signalpoint/DrupalGap/issues/947","id":246521844,"number":947,"title":"Select List on Custom Form","user":{"login":"igenroot","id":11537035,"avatar_url":"https://avatars1.githubusercontent.com/u/11537035?v=4","gravatar_id":"","url":"https://api.github.com/users/igenroot","html_url":"https://github.com/igenroot","followers_url":"https://api.github.com/users/igenroot/followers","following_url":"https://api.github.com/users/igenroot/following{/other_user}","gists_url":"https://api.github.com/users/igenroot/gists{/gist_id}","starred_url":"https://api.github.com/users/igenroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igenroot/subscriptions","organizations_url":"https://api.github.com/users/igenroot/orgs","repos_url":"https://api.github.com/users/igenroot/repos","events_url":"https://api.github.com/users/igenroot/events{/privacy}","received_events_url":"https://api.github.com/users/igenroot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-29T13:34:08Z","updated_at":"2017-07-29T14:38:05Z","closed_at":null,"body":"Hi everyone,\r\n\r\nI having an issue  ```node_save``` when use select list type on custom form. From console output\r\n\r\n ```\r\nPOST \r\nXHR \r\nhttp://localhost/[HTTP/1.1 406 Not Acceptable : An illegal choice has been detected. Please contact the site administrator. An illegal choice has been detected. Please contact the site administrator. 198ms]\r\n\"POST: http://localhost/?q=drupalgap/node.json - 406 - Not Acceptable : An illegal choice has been detected. Please contact the site administrator. An illegal choice has been detected. Please contact the site administrator.\"  jdrupal-7.0.5.min.js:2:547\r\n{\"form_errors\":{\"field_article_type][und\":\"An illegal choice has been detected. Please contact the site administrator.\"} \r\n ```\r\n\r\nHere's the source code \r\n ```\r\nfunction my_module_articles_form(form, form_state, node) {\r\n  if (node.nid) {\r\n    form.id += '_' + node.nid;\r\n    form.elements['nid'] = {\r\n        type: 'hidden',\r\n        required: true,\r\n        default_value: node.nid\r\n      };\r\n  }\r\n  form.elements['type'] = {\r\n        type: 'hidden',\r\n        required: true,\r\n        default_value: 'articles'\r\n  };\r\n  form.elements['articletype'] = {\r\n      title: 'Type Article',\r\n      required: false,\r\n      type: 'select',\r\n      options: {\r\n        0: 'Article A',\r\n        1: 'Article B'\r\n        2: 'Article C'\r\n      }, \r\n      default_value: '0'\r\n  };\r\n  form.elements['submit'] =  {\r\n    type: 'submit',\r\n    value: t('Save')\r\n  };\r\n  return form;\r\n}\r\n\r\n ```\r\n\r\n ```\r\nfunction my_module_articles_form_submit(form, form_state) {\r\n  try {\r\n    \r\n    var data_to_save = {\r\n      language: form_state.values.language,\r\n      type: form_state.values.type,\r\n      field_article_type: { und: [ { value: form_state.values.articletype } ] },\r\n    };\r\n  \r\n    node_save(data_to_save, {\r\n      success: function(result) {\r\n        drupalgap_goto('node/' + result.nid, { reloadPage: true });\r\n      }\r\n    });\r\n  \r\n  }\r\n  catch (error) { console.log('my_module_articles_form_submit - ' + error); }\r\n}\r\n\r\n ```\r\n\r\nIs there any workaround to overcome this issue.\r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/signalpoint/DrupalGap/issues/comments/318835265","html_url":"https://github.com/signalpoint/DrupalGap/issues/947#issuecomment-318835265","issue_url":"https://api.github.com/repos/signalpoint/DrupalGap/issues/947","id":318835265,"user":{"login":"mkinnan","id":13283396,"avatar_url":"https://avatars1.githubusercontent.com/u/13283396?v=4","gravatar_id":"","url":"https://api.github.com/users/mkinnan","html_url":"https://github.com/mkinnan","followers_url":"https://api.github.com/users/mkinnan/followers","following_url":"https://api.github.com/users/mkinnan/following{/other_user}","gists_url":"https://api.github.com/users/mkinnan/gists{/gist_id}","starred_url":"https://api.github.com/users/mkinnan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkinnan/subscriptions","organizations_url":"https://api.github.com/users/mkinnan/orgs","repos_url":"https://api.github.com/users/mkinnan/repos","events_url":"https://api.github.com/users/mkinnan/events{/privacy}","received_events_url":"https://api.github.com/users/mkinnan/received_events","type":"User","site_admin":false},"created_at":"2017-07-29T14:38:05Z","updated_at":"2017-07-29T14:38:05Z","body":"Should it be `form.elements['article_type']`?"}}
{"actor":{"display_login":"mkinnan"}}