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)

Comments

mariacha1 created an issue. See original summary.

mariacha1’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new0 bytes

Here's that patch

mariacha1’s picture

StatusFileSize
new686 bytes

Oops, bad patch contained nothing!

gcb’s picture

Status: Needs review » Reviewed & tested by the community

This seems very sensible!

aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed

Fixed, thanks for the patch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.