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)
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | salesforce_address_max_char-3382969-2.patch | 686 bytes | mariacha1 |
Comments
Comment #2
mariacha1 commentedHere's that patch
Comment #3
mariacha1 commentedOops, bad patch contained nothing!
Comment #4
gcbThis seems very sensible!
Comment #6
aaronbaumanFixed, thanks for the patch