Skip to content

Address Autocomplete ParseAddress not working #19

@RuneHanssens

Description

@RuneHanssens

Hi,

I am trying to change the way the street is displayed using the ParseAddress function as described in the example. In my country the format of the address is streetname + number not number + street. I was going to solve this with following custom script. When I search for an address and click it, nothing happens. When debugging, my code gets executed and gives the expected result. I even get to notifyOutputChanged and there the address looks as expected but no value gets changed on the form. When I remove my script it works (expect for the format).

function getConfiguration(){
    function parseAddress(address) {
        return new Promise(function(resolve, reject){
            if(address.street){
                var parts = address.street.split(' ');
                // check if first part of address starts with a number
                if(parts[0] && /^\d/.test(parts[0])){
                    // move the housenumber to last element in array
                    var houseNumber = parts.shift();
                    parts.push(houseNumber);
                    // recreate street
                    address.street = parts.join(' ');
                }
            }
            resolve(address);
        });
    }

    return {
        ParseAddress: parseAddress
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions