{"action":"created","issue":{"url":"https://api.github.com/repos/octobercms/october/issues/3293","repository_url":"https://api.github.com/repos/octobercms/october","labels_url":"https://api.github.com/repos/octobercms/october/issues/3293/labels{/name}","comments_url":"https://api.github.com/repos/octobercms/october/issues/3293/comments","events_url":"https://api.github.com/repos/octobercms/october/issues/3293/events","html_url":"https://github.com/octobercms/october/issues/3293","id":280554680,"number":3293,"title":"Boolean fields are interpreted wrongly in the fields.yaml","user":{"login":"mohib0306","id":22475427,"avatar_url":"https://avatars1.githubusercontent.com/u/22475427?v=4","gravatar_id":"","url":"https://api.github.com/users/mohib0306","html_url":"https://github.com/mohib0306","followers_url":"https://api.github.com/users/mohib0306/followers","following_url":"https://api.github.com/users/mohib0306/following{/other_user}","gists_url":"https://api.github.com/users/mohib0306/gists{/gist_id}","starred_url":"https://api.github.com/users/mohib0306/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohib0306/subscriptions","organizations_url":"https://api.github.com/users/mohib0306/orgs","repos_url":"https://api.github.com/users/mohib0306/repos","events_url":"https://api.github.com/users/mohib0306/events{/privacy}","received_events_url":"https://api.github.com/users/mohib0306/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-08T17:03:43Z","updated_at":"2017-12-08T17:19:45Z","closed_at":null,"author_association":"NONE","body":"Hi;\r\n\r\nI have a nullable boolean field (my_field) in my table. I used the following configurations in the fields.yaml file of the corresponding model.\r\n```\r\n    my_field:\r\n        label: My Field\r\n        type: radio\r\n        options:\r\n             1: 'Yes'\r\n             0: 'No'\r\n```\r\nor\r\n```\r\n    my_field:\r\n        label: My Field\r\n        type: radio\r\n        options:\r\n             true: 'Yes'\r\n             false: 'No'\r\n```\r\n\r\nThe expected behavior is that if the field is `false` in the table, then `No` should be selected. And in case of `Null` none of the two options should be selected. But this does not happen and either of the above configurations the `No` is not selected.\r\n\r\nI looked into the `/modules/backend/widgets/form/partials/_field_radio.htm` and on Line 22 it is calling `ìsSelected()` function, which evaluates the `false` value to `empty string` in its `return (string) $value === (string) $this->value;`\r\n\r\nI changed the Line 22 in `/modules/backend/widgets/form/partials/_field_radio.htm` to `<?= (int) $field->value === $value ? 'checked=\"checked\"' : '' ?>` and it works.\r\n\r\n\"name\": \"october/backend\",\r\n            \"version\": \"v1.0.428\",\r\n"},"comment":{"url":"https://api.github.com/repos/octobercms/october/issues/comments/350319759","html_url":"https://github.com/octobercms/october/issues/3293#issuecomment-350319759","issue_url":"https://api.github.com/repos/octobercms/october/issues/3293","id":350319759,"user":{"login":"mohib0306","id":22475427,"avatar_url":"https://avatars1.githubusercontent.com/u/22475427?v=4","gravatar_id":"","url":"https://api.github.com/users/mohib0306","html_url":"https://github.com/mohib0306","followers_url":"https://api.github.com/users/mohib0306/followers","following_url":"https://api.github.com/users/mohib0306/following{/other_user}","gists_url":"https://api.github.com/users/mohib0306/gists{/gist_id}","starred_url":"https://api.github.com/users/mohib0306/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohib0306/subscriptions","organizations_url":"https://api.github.com/users/mohib0306/orgs","repos_url":"https://api.github.com/users/mohib0306/repos","events_url":"https://api.github.com/users/mohib0306/events{/privacy}","received_events_url":"https://api.github.com/users/mohib0306/received_events","type":"User","site_admin":false},"created_at":"2017-12-08T17:19:45Z","updated_at":"2017-12-08T17:19:45Z","author_association":"NONE","body":"Actually the problem is not only with the `type: radio` but other types of fields i.e. dropdown, ballon-selector etc. as well"}}
{"actor":{"display_login":"mohib0306"}}