justbetter/statamic-postcodeservice

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

Package for adding postcodeservice form fields

2.0.1 2023-08-21 09:44 UTC

This package is auto-updated.

Last update: 2024-04-21 11:09:27 UTC


README

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'.