Skip to content

postdirekt-autocomplete-library 1.4.0

Install from the command line:
Learn more about npm packages
$ npm install @netresearch/postdirekt-autocomplete-library@1.4.0
Install via package.json:
"@netresearch/postdirekt-autocomplete-library": "1.4.0"

About this version

Deutsche Post Direkt DATAFACTORY Autocomplete Library

Manual Installation

  1. Pick the format you need from `dist/browser/postdirekt-autocomplete-lib.*.js
  2. Move the .js file to your project
  3. Move the file dist/browser/styles.css to your project

Usage

Include the library .js and .css on the HTML page where your form is located:

<head>
    <script type="text/javascript"
            src="path/to/postdirekt-autocomplete-lib.*.js"></script>
    <link rel="stylesheet"
        type="text/css"
        href="path/to/styles.css">
</head>

Instantiate the library, passing in the following information:

  • the HTMLInputElements for your street, city, postal code and country inputs
  • the country input value that maps to "Germany"
  • a valid DATAFACTORY Autocomplete access token. You can generate a token from PHP with the PHP Authentication SDK
postdirektAutocompleteLib.init(
        document.querySelector('[id="shipping:street1"]'),
        document.querySelector('[id="shipping:city"]'),
        document.querySelector('[id="shipping:postcode"]'),
        document.querySelector('[name="shipping[country_id]"]'),
        'DE',
        'YOUR_ACCESS_TOKEN',
        'YOUR_HOUSENUMBER_HINT_TEXT'
    );

Additional Options

The library also supports the following optional parameters:

  • renderSuggestions - boolean, default true. If false, the library will not render suggestions by itself. You can implement your own suggestion rendering by listening to the 'autocomplete:suggestions-retrieve' event on the document.
  • 'autocomplete:suggestions-retrieve' event will contain the suggestions and a pointer to the source element.

Details


Assets

  • postdirekt-autocomplete-library-1.4.0.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all