{"action":"opened","issue":{"url":"https://api.github.com/repos/daurnimator/lua.vm.js/issues/55","repository_url":"https://api.github.com/repos/daurnimator/lua.vm.js","labels_url":"https://api.github.com/repos/daurnimator/lua.vm.js/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/daurnimator/lua.vm.js/issues/55/comments","events_url":"https://api.github.com/repos/daurnimator/lua.vm.js/issues/55/events","html_url":"https://github.com/daurnimator/lua.vm.js/issues/55","id":161043400,"number":55,"title":"Question about AddEventListener and general callbacks","user":{"login":"MangelMaxime","id":4760796,"avatar_url":"https://avatars.githubusercontent.com/u/4760796?v=3","gravatar_id":"","url":"https://api.github.com/users/MangelMaxime","html_url":"https://github.com/MangelMaxime","followers_url":"https://api.github.com/users/MangelMaxime/followers","following_url":"https://api.github.com/users/MangelMaxime/following{/other_user}","gists_url":"https://api.github.com/users/MangelMaxime/gists{/gist_id}","starred_url":"https://api.github.com/users/MangelMaxime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MangelMaxime/subscriptions","organizations_url":"https://api.github.com/users/MangelMaxime/orgs","repos_url":"https://api.github.com/users/MangelMaxime/repos","events_url":"https://api.github.com/users/MangelMaxime/events{/privacy}","received_events_url":"https://api.github.com/users/MangelMaxime/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-18T21:06:41Z","updated_at":"2016-06-18T21:06:41Z","closed_at":null,"body":"Hello I am trying to prevent a form to be submit.\r\nHere is my code. \r\n\r\n```lua\r\nfunction init()\r\n  local form = document:querySelector(\".to-validate\")\r\n  if notNullJs(form) then\r\n\r\n    form:addEventListener(\r\n      \"submit\",\r\n      function (event)\r\n        print(event)\r\n        event:preventDefault()\r\n      end,\r\n      false)\r\n  end\r\nend\r\n```\r\n\r\nWhen I submit the form, I always got this error: `Lua.Error: [string \"validator.lua\"]:12: attempt to call method 'preventDefault' (a nil value)`\r\n\r\nCan you explain me what I am doing wrong ? And also, if this is possible to define the callback as a standard function outside of `addEventListener`"}}
{"actor":{"display_login":"MangelMaxime"}}