{"action":"created","issue":{"url":"https://api.github.com/repos/rnicholus/ajax-form/issues/63","labels_url":"https://api.github.com/repos/rnicholus/ajax-form/issues/63/labels{/name}","comments_url":"https://api.github.com/repos/rnicholus/ajax-form/issues/63/comments","events_url":"https://api.github.com/repos/rnicholus/ajax-form/issues/63/events","html_url":"https://github.com/rnicholus/ajax-form/issues/63","id":80627816,"number":63,"title":"Proper handling of Paper elements","user":{"login":"eximius313","id":5578017,"avatar_url":"https://avatars.githubusercontent.com/u/5578017?v=3","gravatar_id":"","url":"https://api.github.com/users/eximius313","html_url":"https://github.com/eximius313","followers_url":"https://api.github.com/users/eximius313/followers","following_url":"https://api.github.com/users/eximius313/following{/other_user}","gists_url":"https://api.github.com/users/eximius313/gists{/gist_id}","starred_url":"https://api.github.com/users/eximius313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eximius313/subscriptions","organizations_url":"https://api.github.com/users/eximius313/orgs","repos_url":"https://api.github.com/users/eximius313/repos","events_url":"https://api.github.com/users/eximius313/events{/privacy}","received_events_url":"https://api.github.com/users/eximius313/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-25T18:41:22Z","updated_at":"2015-05-25T23:25:04Z","closed_at":"2015-05-25T20:40:07Z","body":"There are three Paper elements not handled correctly by Ajax Form 2.0.0\r\n1)Paper checkbox\r\n```\r\n<core-label for=\"#myPaperCheckbox\">\r\n\t<paper-checkbox id=\"myPaperCheckbox\" name=\"myPaperCheckbox\" checked></paper-checkbox>\r\nText</core-label>\r\n```\r\nEven though paper checkbox have - like regular checkbox - an \"checked\" attribute, Ajax form doesn't take it into consideration. One have to do a workaround like this:\r\n```\r\ndocument.querySelector('#myForm').addEventListener('submitting', function(e) {\r\n\tvar formData = e.detail.formData;\r\n\tvar myPaperCheckbox = document.getElementById('myPaperCheckbox');\r\n\tif (!myPaperCheckbox.checked) {\r\n\t\tformData[myPaperCheckbox.id] = '';\r\n\t} else {\r\n\t\tformData[myPaperCheckbox.id] = myPaperCheckbox.checked;\r\n\t}\r\n}\r\n```\r\n\r\n2)Paper checkbox group\r\nSame here:\r\n```\r\n<div id=\"myPaperCheckboxes\" class=\"checkbox-group\">\r\n   \t<core-label for=\"#myPaperCheckboxes_OPTION1\"><paper-checkbox id=\"myPaperCheckboxes_OPTION1\" name=\"myPaperCheckboxes[]\" value=\"OPTION1\" checked></paper-checkbox>Option 1</core-label>\r\n\t<core-label for=\"#myPaperCheckboxes_OPTION2\"><paper-checkbox id=\"myPaperCheckboxes_OPTION2\" name=\"myPaperCheckboxes[]\" value=\"OPTION2\"></paper-checkbox>Option 2</core-label>\r\n</div>\r\n```\r\nThe workaround is:\r\n```\r\ndocument.querySelector('#myForm').addEventListener('submitting', function(e) {\r\n\tvar formData = e.detail.formData;\r\n\tvar myPaperCheckboxes = [];\r\n\t[].forEach.call(document.querySelectorAll(\"#myPaperCheckboxes paper-checkbox[checked]\"), function(el,i){\r\n\t\tmyPaperCheckboxes.push(el.getAttribute(\"value\"));\r\n\t});\r\n\tformData[myPaperCheckboxes.id+'[]']=myPaperCheckboxes;\r\n}\r\n```\r\n\r\nAnd last, but not least, paper radio group, which has standard \"selected\" attribute is not working as well:\r\n```\r\n<paper-radio-group id=\"myPaperRadioGroup \" selected=\"OPTION1\">\r\n    <paper-radio-button name=\"OPTION1\" label=\"Option 1\"></paper-radio-button>\r\n    <paper-radio-button name=\"OPTION2\" label=\"Option 2\"></paper-radio-button>\r\n</paper-radio-group>\r\n```\r\nThe workaround:\r\n```\r\ndocument.querySelector('#myForm').addEventListener('submitting', function(e) {\r\n\tvar formData = e.detail.formData;\r\n\tvar myPaperRadioGroup = document.getElementById('myPaperRadioGroup');\r\n\tif (!myPaperRadioGroup.selected) {\r\n\t\tformData[myPaperRadioGroup.id] = '';\r\n\t} else {\r\n\t\tformData[myPaperRadioGroup.id] = myPaperRadioGroup.selected;\r\n\t}\r\n}\r\n```\r\n\r\nCan you please fix it?\r\nKind regards"},"comment":{"url":"https://api.github.com/repos/rnicholus/ajax-form/issues/comments/105334043","html_url":"https://github.com/rnicholus/ajax-form/issues/63#issuecomment-105334043","issue_url":"https://api.github.com/repos/rnicholus/ajax-form/issues/63","id":105334043,"user":{"login":"eximius313","id":5578017,"avatar_url":"https://avatars.githubusercontent.com/u/5578017?v=3","gravatar_id":"","url":"https://api.github.com/users/eximius313","html_url":"https://github.com/eximius313","followers_url":"https://api.github.com/users/eximius313/followers","following_url":"https://api.github.com/users/eximius313/following{/other_user}","gists_url":"https://api.github.com/users/eximius313/gists{/gist_id}","starred_url":"https://api.github.com/users/eximius313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eximius313/subscriptions","organizations_url":"https://api.github.com/users/eximius313/orgs","repos_url":"https://api.github.com/users/eximius313/repos","events_url":"https://api.github.com/users/eximius313/events{/privacy}","received_events_url":"https://api.github.com/users/eximius313/received_events","type":"User","site_admin":false},"created_at":"2015-05-25T23:25:04Z","updated_at":"2015-05-25T23:25:04Z","body":"How I can send you a PW with access?"}}