webform_openpostcode
Security covered
Webform Open Postcode integrates the Open Postcode (openpostcode.nl) API with Drupal Webform to provide automatic, free Dutch address lookup functionality. When users enter a postcode and house number in a webform, this module automatically populates related address fields (street, city) using the Open Postcode API, without the need for API keys or subscription fees. See Open Postcode for more information.
This module was partially created with AI. This module does not work work with the Webform address fields, because it needs separate street and house number fields. Also, the UX requires the internationally somewhat odd order of first asking for postal code and house number. Because of this, the form needs to use separate fields for all parts of the address.Table of contents
Requirements
- Drupal 10 or 11
- Webform module
- PHP 8.1 or higher
- Internet connection (for API calls to openpostcode.nl)
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Configuration
Configuring a Webform Element
- Edit your webform and navigate to the element you want to use as the postcode input field.
- In the element configuration form, expand the “Open Postcode” section
- Enable the checkbox “Enable Open Postcode lookup on this element”
- Configure the following settings:
- House number element key: The webform element key that contains the house number (e.g.,
huisnummer) - Street target element key: The element key where the street name should be populated (e.g.,
straat) - City target element key: The element key where the city name should be populated (e.g.,
woonplaats)
- House number element key: The webform element key that contains the house number (e.g.,
Troubleshooting & FAQ
- An API key is not required.
- If values don’t populate, verify both postcode and house number are filled.
- Check logs (channel
webform_openpostcode) for lookup failures. - Cached results persist for 12 hours; clear caches to re-test fresh results.