{"action":"created","issue":{"url":"https://api.github.com/repos/hyperoslo/Form/issues/477","labels_url":"https://api.github.com/repos/hyperoslo/Form/issues/477/labels{/name}","comments_url":"https://api.github.com/repos/hyperoslo/Form/issues/477/comments","events_url":"https://api.github.com/repos/hyperoslo/Form/issues/477/events","html_url":"https://github.com/hyperoslo/Form/issues/477","id":110293532,"number":477,"title":"How to add selector to button type","user":{"login":"annehiro","id":4204621,"avatar_url":"https://avatars.githubusercontent.com/u/4204621?v=3","gravatar_id":"","url":"https://api.github.com/users/annehiro","html_url":"https://github.com/annehiro","followers_url":"https://api.github.com/users/annehiro/followers","following_url":"https://api.github.com/users/annehiro/following{/other_user}","gists_url":"https://api.github.com/users/annehiro/gists{/gist_id}","starred_url":"https://api.github.com/users/annehiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/annehiro/subscriptions","organizations_url":"https://api.github.com/users/annehiro/orgs","repos_url":"https://api.github.com/users/annehiro/repos","events_url":"https://api.github.com/users/annehiro/events{/privacy}","received_events_url":"https://api.github.com/users/annehiro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-07T18:59:19Z","updated_at":"2015-10-07T19:37:54Z","closed_at":"2015-10-07T19:37:54Z","body":"Is it possible to do this?"},"comment":{"url":"https://api.github.com/repos/hyperoslo/Form/issues/comments/146305281","html_url":"https://github.com/hyperoslo/Form/issues/477#issuecomment-146305281","issue_url":"https://api.github.com/repos/hyperoslo/Form/issues/477","id":146305281,"user":{"login":"3lvis","id":1088217,"avatar_url":"https://avatars.githubusercontent.com/u/1088217?v=3","gravatar_id":"","url":"https://api.github.com/users/3lvis","html_url":"https://github.com/3lvis","followers_url":"https://api.github.com/users/3lvis/followers","following_url":"https://api.github.com/users/3lvis/following{/other_user}","gists_url":"https://api.github.com/users/3lvis/gists{/gist_id}","starred_url":"https://api.github.com/users/3lvis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3lvis/subscriptions","organizations_url":"https://api.github.com/users/3lvis/orgs","repos_url":"https://api.github.com/users/3lvis/repos","events_url":"https://api.github.com/users/3lvis/events{/privacy}","received_events_url":"https://api.github.com/users/3lvis/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T19:37:54Z","updated_at":"2015-10-07T19:37:54Z","body":"Hi @annehiro,\r\n\r\nShould be quite simple using the FORMDataSource's `FORMFieldFieldUpdatedBlock`.\r\n\r\n```json\r\n[\r\n  {\r\n    \"id\":\"group-id\",\r\n    \"sections\":[\r\n      {\r\n        \"id\":\"section-0\",\r\n        \"fields\":[\r\n          {\r\n              \"id\":\"pay_button\",\r\n              \"title\":\"Pay\",\r\n              \"type\":\"button\",\r\n              \"size\":{\r\n                \"width\":100,\r\n                \"height\":1\r\n              }\r\n            }\r\n        ]\r\n      }\r\n    ]\r\n  }\r\n]\r\n```\r\n\r\n```swift\r\nlet fieldUpdatedBlock: FORMFieldFieldUpdatedBlock =  { cell, field in\r\n    if field.fieldID == \"pay_button\" {\r\n        if self.dataSource.valid == false {\r\n            self.dataSource.validate()\r\n        } else {\r\n            print(\"Successfull values, process shopping cart!\")\r\n        }\r\n    }\r\n}\r\n\r\nself.dataSource.fieldUpdatedBlock = fieldUpdatedBlock\r\n```\r\n\r\nFind the complete example in the Payment Demo. https://github.com/hyperoslo/Form/tree/master/Demos/Payment\r\n\r\nBest,"}}