{"action":"created","issue":{"url":"https://api.github.com/repos/braintree/braintree-web/issues/155","repository_url":"https://api.github.com/repos/braintree/braintree-web","labels_url":"https://api.github.com/repos/braintree/braintree-web/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/braintree/braintree-web/issues/155/comments","events_url":"https://api.github.com/repos/braintree/braintree-web/issues/155/events","html_url":"https://github.com/braintree/braintree-web/issues/155","id":147035714,"number":155,"title":"Disabling submit with hosted fields","user":{"login":"rickhall","id":270425,"avatar_url":"https://avatars.githubusercontent.com/u/270425?v=3","gravatar_id":"","url":"https://api.github.com/users/rickhall","html_url":"https://github.com/rickhall","followers_url":"https://api.github.com/users/rickhall/followers","following_url":"https://api.github.com/users/rickhall/following{/other_user}","gists_url":"https://api.github.com/users/rickhall/gists{/gist_id}","starred_url":"https://api.github.com/users/rickhall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickhall/subscriptions","organizations_url":"https://api.github.com/users/rickhall/orgs","repos_url":"https://api.github.com/users/rickhall/repos","events_url":"https://api.github.com/users/rickhall/events{/privacy}","received_events_url":"https://api.github.com/users/rickhall/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/braintree/braintree-web/labels/Hosted%20Fields","name":"Hosted Fields","color":"19A3FF"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/braintree/braintree-web/milestones/2","html_url":"https://github.com/braintree/braintree-web/milestones/3.0.0","labels_url":"https://api.github.com/repos/braintree/braintree-web/milestones/2/labels","id":1721734,"number":2,"title":"3.0.0","description":"","creator":{"login":"mrak","id":491140,"avatar_url":"https://avatars.githubusercontent.com/u/491140?v=3","gravatar_id":"","url":"https://api.github.com/users/mrak","html_url":"https://github.com/mrak","followers_url":"https://api.github.com/users/mrak/followers","following_url":"https://api.github.com/users/mrak/following{/other_user}","gists_url":"https://api.github.com/users/mrak/gists{/gist_id}","starred_url":"https://api.github.com/users/mrak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrak/subscriptions","organizations_url":"https://api.github.com/users/mrak/orgs","repos_url":"https://api.github.com/users/mrak/repos","events_url":"https://api.github.com/users/mrak/events{/privacy}","received_events_url":"https://api.github.com/users/mrak/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":0,"state":"open","created_at":"2016-04-20T23:21:06Z","updated_at":"2016-04-20T23:22:22Z","due_on":null,"closed_at":null},"comments":14,"created_at":"2016-04-08T20:46:55Z","updated_at":"2016-04-21T18:15:02Z","closed_at":null,"body":"I had contacted support with this question, but I'll re-enter it here to capture it.\r\n\r\nI am using custom integration with hosted fields and I would like to disable the submit button while waiting to get the payment nonce. My current approach is to:\r\n\r\n1. Add a submit listener on the form which always disables the submit UI button upon seeing a submit event.\r\n2. In braintree onError callback, I re-enable submit button in case of any validation errors.\r\n3. In onPaymentMethodReceived callback, I then send the payment nonce to my server.\r\n\r\nThis basically works ok and prevents duplicate submits if and only if the user clicks on the “submit” button.\r\n\r\nUnfortunately, if the user uses the \"return\" key to submit the form, then the native submit event isn’t fired. This makes it so I cannot give my user any visual feedback that something is going on, increasing the likelihood that they may try to resubmit if it takes a long time.\r\n\r\nPerhaps I’m missing something, but I’ve searched the web a bit and it seems that a lot of people want to do this flow, but it is more difficult than it seems it should be. It seems like adding some sort of “beforeSubmit” callback after everything is validated, but just before submitting to braintree server would make this flow a lot more intuitive.\r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/braintree/braintree-web/issues/comments/213043593","html_url":"https://github.com/braintree/braintree-web/issues/155#issuecomment-213043593","issue_url":"https://api.github.com/repos/braintree/braintree-web/issues/155","id":213043593,"user":{"login":"mrak","id":491140,"avatar_url":"https://avatars.githubusercontent.com/u/491140?v=3","gravatar_id":"","url":"https://api.github.com/users/mrak","html_url":"https://github.com/mrak","followers_url":"https://api.github.com/users/mrak/followers","following_url":"https://api.github.com/users/mrak/following{/other_user}","gists_url":"https://api.github.com/users/mrak/gists{/gist_id}","starred_url":"https://api.github.com/users/mrak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrak/subscriptions","organizations_url":"https://api.github.com/users/mrak/orgs","repos_url":"https://api.github.com/users/mrak/repos","events_url":"https://api.github.com/users/mrak/events{/privacy}","received_events_url":"https://api.github.com/users/mrak/received_events","type":"User","site_admin":false},"created_at":"2016-04-21T18:15:02Z","updated_at":"2016-04-21T18:15:02Z","body":"We don't have a hard ETA yet, but we are planning to release a beta soon."}}