1Basic Address Validation Usage

The address validation in its simplest usage can validate an address from within any website. To do so a JavaScript has to be embedded and the corresponding JavaScript function can be then used to validate the address.

Below there is a simple example:

<script type="text/javascript" src=""></script>

<script type="text/javascript">
var address = {
	"givenName": "Marc",
	"familyName": "Stiffer",
	"street": "Some Street Name including street number etc.",
	"postcode": "The post code of the address. e.g. 8000",
	"country": "US",
	"postalState": "CA",
	"city": "Some City Name"

	// You may want to continue processing here.
	console.log("The address is valid.");
}, function(invalidFields){

	for(var i = 0; i < invalidFields.length; i++){
		var fieldName = invalidFields[i].field;
		var errorMessage = invalidFields[i].message;
		// Here you may want to implement the user feedback about the invalid address field.
		console.log("The field " + fieldName + " is invalid. Error: " + errorMessage);

The above example will validates the provided address. The error messages provided in the response will depend on the browser language. The language can also be enforced by providing a language parameter on the address-handler.js. For example if German should be enforced the following URL can be used:

<script type="text/javascript" src=""></script>

2Country, Country State and Legal Organization Form Lists

Typically a address may be constructed within the browser. However there a list of available countries, country states and organization forms may need to be displayed. The example below shows the way to use the address validation to fetch those data items:

<script type="text/javascript" src=""></script>

<script type="text/javascript">
AddressHandler.getCountries().then(function(countries) {

AddressHandler.getCountryStates("CH").then(function(states) {

AddressHandler.getLegalOrganizationForms("CH").then(function(legalForms) {