{"id":20447314,"url":"https://github.com/wilfredpine/philippine-address-selector","last_synced_at":"2025-04-13T01:07:42.206Z","repository":{"id":62040773,"uuid":"415810962","full_name":"wilfredpine/philippine-address-selector","owner":"wilfredpine","description":"Autofill selects input of Region, Province, City/Municipality, and Barangay in the Philippines.","archived":false,"fork":false,"pushed_at":"2024-02-18T08:44:07.000Z","size":829,"stargazers_count":24,"open_issues_count":3,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T01:07:36.680Z","etag":null,"topics":["address","autofill","barangay","city","html","javascript","jquery","json","municipalities","philippines","regions","select","selector","web"],"latest_commit_sha":null,"homepage":"https://geoproject.confired.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wilfredpine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-11T06:54:01.000Z","updated_at":"2025-04-02T11:16:35.000Z","dependencies_parsed_at":"2024-11-15T10:31:52.702Z","dependency_job_id":"35c83733-cc50-4c29-9183-7f005bbb7996","html_url":"https://github.com/wilfredpine/philippine-address-selector","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fphilippine-address-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fphilippine-address-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fphilippine-address-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilfredpine%2Fphilippine-address-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilfredpine","download_url":"https://codeload.github.com/wilfredpine/philippine-address-selector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650771,"owners_count":21139681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","autofill","barangay","city","html","javascript","jquery","json","municipalities","philippines","regions","select","selector","web"],"created_at":"2024-11-15T10:25:47.575Z","updated_at":"2025-04-13T01:07:42.182Z","avatar_url":"https://github.com/wilfredpine.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Address Selector - Philippines\n### PH Address JSON file from https://github.com/isaacdarcilla/philippine-addresses\n\n![This is an image](https://lh3.googleusercontent.com/pw/AM-JKLU7NduoFSLoDW5Nz6l33o8-xRkynZIVAxuFjCYkKKmgtrTHxSSVz3gISZEsn9lb0OGG4MqIo0xAkygD0-5d0CV9VOpaqifVgEFgxc5k8ZYG3aiFvpLtUgq9XF69ONIwhKu9psfNKxDg8-XT4uf474DA=w909-h549-no?authuser=0)\n\n### PSA PSGC\nhttps://www.psa.gov.ph/classification/psgc\n\n### Requirements:\n- JQUERY\n\n```html\n  \u003cscript src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\"\u003e\u003c/script\u003e\n```\n\n- HTML Tags\n\n```html\n    \u003cselect id=\"region\"\u003e\u003c/select\u003e\n    \u003cinput type=\"hidden\" name=\"region_text\" id=\"region-text\"\u003e\n\n    \u003cselect id=\"province\"\u003e\u003c/select\u003e\n    \u003cinput type=\"hidden\" name=\"province_text\" id=\"province-text\"\u003e\n\n    \u003cselect id=\"city\"\u003e\u003c/select\u003e\n    \u003cinput type=\"hidden\" name=\"city_text\" id=\"city-text\"\u003e\n\n    \u003cselect id=\"barangay\"\u003e\u003c/select\u003e\n    \u003cinput type=\"hidden\" name=\"barangay_text\" id=\"barangay-text\"\u003e\n```\n\n- Javascript\n\nLoad Region\n```javascript\n    // load region\n    let dropdown = $('#region');\n    dropdown.empty();\n    dropdown.append('\u003coption selected=\"true\" disabled\u003eChoose Region\u003c/option\u003e');\n    dropdown.prop('selectedIndex', 0);\n    const url = 'ph-json/region.json';\n    // Populate dropdown with list of regions\n    $.getJSON(url, function (data) {\n        $.each(data, function (key, entry) {\n            dropdown.append($('\u003coption\u003e\u003c/option\u003e').attr('value', entry.region_code).text(entry.region_name));\n        })\n    });\n```\n\nChange or Select Region\n```javascript\n// load provinces\n$('#region').on('change', my_handlers.fill_provinces);\n```\n\nLoad Province Function\n```javascript\n  function(){\n    //selected region\n    var region_code = $(this).val();\n\n    // set selected text to input\n    var region_text = $(this).find(\"option:selected\").text();\n    let region_input = $('#region-text');\n    region_input.val(region_text);\n    \n    //province\n    let dropdown = $('#province');\n    dropdown.empty();\n    dropdown.append('\u003coption selected=\"true\" disabled\u003eChoose State/Province\u003c/option\u003e');\n    dropdown.prop('selectedIndex', 0);\n\n    // filter \u0026 fill\n    var url = 'ph-json/province.json';\n    $.getJSON(url, function(data) {\n        var result = data.filter(function(value){\n            return value.region_code == region_code;\n        });\n\n        result.sort(function (a, b) {\n            return a.province_name.localeCompare(b.province_name);\n        });\n\n        $.each(result, function (key, entry) {\n            dropdown.append($('\u003coption\u003e\u003c/option\u003e').attr('value', entry.province_code).text(entry.province_name));\n        })\n\n    });\n  }\n```\n\n### Full Code\n\n#### HTML\nhttps://github.com/wilfredpine/philippine-address-selector/blob/main/index.html\n\n#### JS\nhttps://github.com/wilfredpine/philippine-address-selector/blob/main/ph-address-selector.js\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilfredpine%2Fphilippine-address-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilfredpine%2Fphilippine-address-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilfredpine%2Fphilippine-address-selector/lists"}