A supplier bank details webform. The SWIFT/BIC field holds COBADEF and is outlined in red, under the message: The value COBADEF for element SWIFT/BIC is not a valid SWIFT/BIC.
Webform with elements to collect a SWIFT/BIC number

Webform SWIFT/BIC Field adds a SWIFT/BIC element to Webform, for forms that ask for the bank identifier of an account: supplier details, refunds, payouts, direct debits. A value that is not a SWIFT/BIC code is refused before the submission is saved, and a code typed in lowercase or in groups is stored in capitals without spaces.

Features

  • 🏦 SWIFT/BIC validation. The value must have 8 or 11 letters and digits, with a country code in fifth and sixth place, checked with the Bic constraint of the Symfony Validator component.
  • 🔤 Typed the way banks print it. Whitespace is removed and letters are made uppercase before validation, so coba de ff xxx is accepted and stored as COBADEFFXXX.
  • ⚙️ The settings of a text field. Required, placeholder, description, conditions, and several codes in one element through Allowed number of values.
  • 📱 On-screen keyboards. The input asks phones for capital letters and turns spell checking off.
  • 🔌 A form element for site code. '#type' => 'webform_bic_field' works in any Drupal form, with the same validation.

A supplier bank details webform. The SWIFT/BIC field holds COBADEF and is outlined in red, under the message: The value COBADEF for element SWIFT/BIC is not a valid SWIFT/BIC.

Quick start

composer require drupal/webform_bic_field
drush en webform_bic_field
  1. Go to Structure > Webforms, edit a webform and click Add element.
  2. Pick Webform SWIFT/BIC field under Advanced elements.
  3. Give it a title, tick Required if the form needs it, and save.
  4. The form now refuses anything that is not a SWIFT/BIC code, and its submissions hold the code in capitals with no spaces.

The webform preview showing the SWIFT/BIC value COBADEFFXXX.

Typed as "coba de ff xxx", previewed and stored as COBADEFFXXX.

Good to know

  • The code is checked for its form, not looked up: whether the bank exists needs a directory of financial institutions, which the module does not ship.
  • Install the module with Composer. It needs the Symfony Intl component to check the country code, and Composer installs it.
  • The module installs an example webform at /webform/webform_bic_field, which only administrators can submit. Delete it if you do not need it.

Additional requirements

  • Drupal 10.3 or later, or Drupal 11.
  • Webform 6.2 or later.
  • The Symfony Intl component, 6.4 or 7, installed by Composer.

Recommended modules/libraries

  • Webform IBAN field: an IBAN element for Webform, for the account number next to the SWIFT/BIC code.

Community documentation

  • README: installation, what is validated, and the example webform.

Supporting this module

Developed and maintained by Bloomidea. Bloomidea offers support and custom development for this module.

Supporting organizations: 
Development and maintenance

Project information

Releases