Municipality validation
With a prefecture selected, enter a municipality name. Validation runs when the field loses focus. Names that do not match an exact official name show an error (getLocalGovCodeByName). Town/street and building fields are decorative only.
Initializing…
<label for="prefecture">Prefecture</label>
<select id="prefecture">
<option value="">Select a prefecture</option>
<!-- Fill options with listPrefectures() -->
</select>
<label for="municipality-name">Municipality name</label>
<input id="municipality-name" type="text" placeholder="千代田区" />
<label for="town">Town / street address</label>
<input id="town" type="text" placeholder="e.g. Marunouchi 1-1-1" />
<label for="building">Building name</label>
<input id="building" type="text" placeholder="e.g. Foo Building 3F" />
<p id="message" hidden></p>