- Issue created by @damienmckenna
- πΊπΈUnited States damienmckenna NH, USA
Related issue: https://github.com/commerceguys/addressing/issues/227
- πΊπΈUnited States damienmckenna NH, USA
Disclaimer: I'm using the address field via a Webform element, so I'm not discounting the possibility that there's a problem with Webform.
- π·πΈSerbia bojanz
The underlying problem is π Address validation doesn't run for form elements, only entity fields Active .
Unfortunately, it never got fixed while Address was more actively developed, so Webform would need to do its own workarond.
- πΊπΈUnited States damienmckenna NH, USA
Thanks for mentioning that issue.
- πΊπΈUnited States jrockowitz Brooklyn, NY
The workaround is documented here. π Address validation doesn't run for form elements, only entity fields Active
- πΊπΈUnited States jrockowitz Brooklyn, NY
The MR is my best attempt to mock an address item instance and use its validate() method.
The tests provide a good POC, but all improvements are welcome.
I am doubtful π Address validation doesn't run for form elements, only entity fields Active will be resolved anytime soon because the complexity of moving validation from the Address item to the element is very challenging, and honestly doesn't make sense.
- Merge request !707Issue #3520969: Validate US ZIP codes in the Advanced Address element β (Merged) created by Liam Morland
- πΊπΈUnited States jrockowitz Brooklyn, NY
I β€οΈ AI.
I wasn't sure how to trigger address validation via a constraint, and PHPStorm's AI pointed me in the right direction.
I think this is the ideal solution.
A similar solution could be contributed to π Address validation doesn't run for form elements, only entity fields Active
- πΊπΈUnited States jrockowitz Brooklyn, NY
Okay, so the AI messed up the code formatting. Everything should be fine now.
- πΊπΈUnited States jrockowitz Brooklyn, NY
Tests are passing. This is feeling pretty safe and good improvement.