Add maxlength to "Salesforce-ready address" form widget

Created on 23 August 2023, 10 months ago
Updated 20 October 2023, 8 months ago

Problem/Motivation

Coming out of https://www.drupal.org/project/salesforce/issues/3170552 β†’ we have a Salesforce-ready address that pushes straight to Salesforce in a format it likes, which is great! But Salesforce only allows 255 characters into that field, so if you enter more, you get an error or a thrown exception. Can you limit the length of that field to 255 characters as well?

Steps to reproduce

Use the "Salesforce-ready address" widget on an address field. On the front end, enter 1000 characters into your Address line. See an error in the logs saying you went over the 255 character limit.

Proposed resolution

Add $element["address_line1"]["#maxlength"] = "255"; to the \Drupal\salesforce_address\Element\AddressStreetAsTextArea element.

Remaining tasks

Review patch

User interface changes

The length of Address 1 fields using this widget will go down to 255 characters, but existing addresses will not be affected (no database change)

πŸ› Bug report
Status

Fixed

Version

5.0

Component

salesforce.module

Created by

πŸ‡ΊπŸ‡ΈUnited States mariacha1

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024