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
- Pick the format you need from `dist/browser/postdirekt-autocomplete-lib.*.js
- Move the
.js
file to your project - Move the file
dist/browser/styles.css
to your project
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
HTMLInputElement
s 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'
);
The library also supports the following optional parameters:
-
renderSuggestions
- boolean, defaulttrue
. Iffalse
, 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
- postdirekt-autocomplete-library
-
netresearch
- 7 months ago
- MIT
- 27 dependencies
Assets
- postdirekt-autocomplete-library-1.4.0.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0