{"action":"created","issue":{"url":"https://api.github.com/repos/ice/framework/issues/97","labels_url":"https://api.github.com/repos/ice/framework/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/ice/framework/issues/97/comments","events_url":"https://api.github.com/repos/ice/framework/issues/97/events","html_url":"https://github.com/ice/framework/issues/97","id":124170823,"number":97,"title":"radio_field() doesn't work when the validation has a error.","user":{"login":"madoka8","id":16357323,"avatar_url":"https://avatars.githubusercontent.com/u/16357323?v=3","gravatar_id":"","url":"https://api.github.com/users/madoka8","html_url":"https://github.com/madoka8","followers_url":"https://api.github.com/users/madoka8/followers","following_url":"https://api.github.com/users/madoka8/following{/other_user}","gists_url":"https://api.github.com/users/madoka8/gists{/gist_id}","starred_url":"https://api.github.com/users/madoka8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madoka8/subscriptions","organizations_url":"https://api.github.com/users/madoka8/orgs","repos_url":"https://api.github.com/users/madoka8/repos","events_url":"https://api.github.com/users/madoka8/events{/privacy}","received_events_url":"https://api.github.com/users/madoka8/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ice/framework/labels/bug","name":"bug","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-29T06:37:38Z","updated_at":"2015-12-29T14:07:39Z","closed_at":"2015-12-29T12:16:05Z","body":"Could you confirm the following example?\r\n## Example ##\r\n### Controller ###\r\n$genders = [1 => 'male', 2 => 'female'];\r\n$this->view->setVars(compact('gender'));\r\n\r\n### View ###\r\n{% set field = 'gender' %}\r\n{% foreach genders as key : value %}\r\n{{ radio_field([field, key, 'id' : field ~ key, 'checked' : (this.request.getPost(field) == key ? 'checked' : '')]) }}\r\n{% endforeach %}\r\n{% if errors|isset and errors.has(field) %}\r\n{{ current(errors.get(field)) }}\r\n{% endif %}"},"comment":{"url":"https://api.github.com/repos/ice/framework/issues/comments/167796261","html_url":"https://github.com/ice/framework/issues/97#issuecomment-167796261","issue_url":"https://api.github.com/repos/ice/framework/issues/97","id":167796261,"user":{"login":"mruz","id":2629882,"avatar_url":"https://avatars.githubusercontent.com/u/2629882?v=3","gravatar_id":"","url":"https://api.github.com/users/mruz","html_url":"https://github.com/mruz","followers_url":"https://api.github.com/users/mruz/followers","following_url":"https://api.github.com/users/mruz/following{/other_user}","gists_url":"https://api.github.com/users/mruz/gists{/gist_id}","starred_url":"https://api.github.com/users/mruz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mruz/subscriptions","organizations_url":"https://api.github.com/users/mruz/orgs","repos_url":"https://api.github.com/users/mruz/repos","events_url":"https://api.github.com/users/mruz/events{/privacy}","received_events_url":"https://api.github.com/users/mruz/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T14:07:39Z","updated_at":"2015-12-29T14:07:39Z","body":"Also you don't need to specify `checked` attribute (it's detected and added automatically):\r\n```django\r\n{% foreach genders as key : value %}\r\n    {{ radio_field([field, key, 'id' : field ~ key]) }}\r\n{% endforeach %}\r\n```"}}