{"action":"created","issue":{"url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/715","repository_url":"https://api.github.com/repos/jackocnr/intl-tel-input","labels_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/715/labels{/name}","comments_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/715/comments","events_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/715/events","html_url":"https://github.com/jackocnr/intl-tel-input/issues/715","id":306879269,"number":715,"title":"How to get Country code to populate on validation failure when phone number is populated","user":{"login":"irfman12","id":645130,"avatar_url":"https://avatars2.githubusercontent.com/u/645130?v=4","gravatar_id":"","url":"https://api.github.com/users/irfman12","html_url":"https://github.com/irfman12","followers_url":"https://api.github.com/users/irfman12/followers","following_url":"https://api.github.com/users/irfman12/following{/other_user}","gists_url":"https://api.github.com/users/irfman12/gists{/gist_id}","starred_url":"https://api.github.com/users/irfman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irfman12/subscriptions","organizations_url":"https://api.github.com/users/irfman12/orgs","repos_url":"https://api.github.com/users/irfman12/repos","events_url":"https://api.github.com/users/irfman12/events{/privacy}","received_events_url":"https://api.github.com/users/irfman12/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-20T14:03:44Z","updated_at":"2018-03-22T12:03:12Z","closed_at":null,"author_association":"NONE","body":"IMPORTANT: please note that the autoFormat feature (format-as-you-type) was removed in v8.0.0 - read more here: https://github.com/jackocnr/intl-tel-input/issues/346. Please do not open any new issues about this topic.\r\n\r\nIMPORTANT: we use libphonenumber for formatting and validation - if your issue relates to one of these things, please check their test site first and if you see the problem there please file an issue with them instead: https://rawgit.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/demo-compiled.html\r\n\r\n### Steps to reproduce\r\n1.  Wrap Phone number field on form\r\n2.  Have error Validations based on Submit function\r\n3.  Cause error validation on some other field\r\n\r\n### Expected behaviour\r\nWhen form reloads, it shoudl automatically select country code because it was populated, along with phone number\r\n\r\n### Actual behaviour\r\nform reloads, with phone number field populated, but country dial code is not selected, \r\n\r\n### Initialisation options\r\n```\r\n(function () {\r\n    if ($(\"#NewUser_PhoneNumber\") != null && $(\"#NewUser_PhoneNumber\") != undefined) {\r\n        $(\"#NewUser_PhoneNumber\").intlTelInput({\r\n            separateDialCode: true,\r\n            hiddenInput: \"NewUser_PhoneFullNumber\",\r\n            nationalMode: true,\r\n            initialCountry: \"auto\",\r\n            geoIpLookup: function (callback) {\r\n                $.get('https://ipinfo.io', function () { }, \"jsonp\").always(function (resp) {\r\n                    var countryCode = (resp && resp.country) ? resp.country : \"\";\r\n                    callback(countryCode);\r\n                });\r\n            },\r\n            utilsScript: \"js/utils.js\"\r\n        });\r\n        $.validator.addMethod('phonenumber',\r\n            function (value, element, params) {\r\n                var telInput = $(element);\r\n                var countryCode = telInput.intlTelInput(\"getSelectedCountryData\");\r\n                $(\"#NewUser_PhoneIso2\").val(countryCode.iso2);\r\n                $(\"#NewUser_PhoneDailCode\").val(countryCode.dialCode);\r\n                return telInput.intlTelInput(\"isValidNumber\");\r\n            });\r\n        $.validator.unobtrusive.adapters.addBool('phonenumber');\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/comments/375280560","html_url":"https://github.com/jackocnr/intl-tel-input/issues/715#issuecomment-375280560","issue_url":"https://api.github.com/repos/jackocnr/intl-tel-input/issues/715","id":375280560,"user":{"login":"jackocnr","id":1186883,"avatar_url":"https://avatars0.githubusercontent.com/u/1186883?v=4","gravatar_id":"","url":"https://api.github.com/users/jackocnr","html_url":"https://github.com/jackocnr","followers_url":"https://api.github.com/users/jackocnr/followers","following_url":"https://api.github.com/users/jackocnr/following{/other_user}","gists_url":"https://api.github.com/users/jackocnr/gists{/gist_id}","starred_url":"https://api.github.com/users/jackocnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackocnr/subscriptions","organizations_url":"https://api.github.com/users/jackocnr/orgs","repos_url":"https://api.github.com/users/jackocnr/repos","events_url":"https://api.github.com/users/jackocnr/events{/privacy}","received_events_url":"https://api.github.com/users/jackocnr/received_events","type":"User","site_admin":false},"created_at":"2018-03-22T12:03:12Z","updated_at":"2018-03-22T12:03:12Z","author_association":"OWNER","body":"> we don't want the full number to show in the input box +447947123456\r\n\r\nIt wont. If you have `nationalMode` enabled (it is by default), then when you call `setNumber` with \"+447947123456\" it will automatically convert it to a national number, namely \"07947123456\" (assuming you have utils.js loaded - also recommended)."}}
{"actor":{"display_login":"jackocnr"}}