justbetter/statamic-postcodeservice

There is no license information available for the latest version (2.1.1) of this package.

Package for adding postcodeservice form fields

2.1.1 2024-09-24 08:11 UTC

This package is auto-updated.

Last update: 2024-11-24 08:43:27 UTC


README

Banner

Statamic Postcodeservice

This addon adds Postcodeservice field types to the Form Builder.

Installation

composer require justbetter/statamic-postcodeservice

Configuration

Add the following items to your .env, these settings consist of the Client ID and the Secure Code provided by Postcodeservice.

POSTCODESERVICE_CLIENT_ID=""
POSTCODESERVICE_SECURE_CODE=""

How to Use

Form settings

When building a form it's now possible to make use of the Postcodeservice fields. When selecting the Postcodeservice field you need to select the according field type, these consist of:

  • Zipcode (Required)
  • House number (Required)
  • House number addition (Optional)
  • Street (Required)
  • City (Required)

Make sure to add all the required field types to your form as they are needed for this to work.

Tags

To add this functionality to your form you have to use our Postcodeservice tag. At the bottom of your form view you need to add the following tag:

Antlers

{{ postcodeservice:initPostcodeservice :formId="form_handle" }}

Blade

{!! Statamic::tag('postcodeservice:initPostcodeservice')->param('formId', $form->handle)->fetch() !!}

Make sure you're using the correct variable when passing the formId, this variable should be the handle of your form. i.e 'contact'.