Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.

MultiLine Composite Address Field #11

Open
ryanperrymba opened this issue Jul 23, 2020 · 0 comments
Open

MultiLine Composite Address Field #11

ryanperrymba opened this issue Jul 23, 2020 · 0 comments

Comments

@ryanperrymba
Copy link

Hi Andrew,

In learning PCF controls, I chose to rebuild your solution to familiarize myself with PCF underpinnings and tailor the solution to meet 3 needs. The latter 2 are not part of the issue, but are related and included for context.

1. Support a multiline composite address field:
While your github support issue #2 indicates multiline is supported, we couldn't bind it to a multiline composite address field. I noted in the manifest that the value property is limited to singleline.Text, and does not allow for SingleLine.TextArea. So, I added a type-group to allow binding to either. If this was the only change, I'd have gladly just confirmed it works in a live system, packaged it up and sent you a pull request + thank you.

But, in the code, I've also noticed this replacement of newlines with commas:

this.currentValues.value = formattedAddress;
this.mainAddressField.value = formattedAddress.replace(/\n/gm, ', '); 

In the harness, I find that newline (/n) characters are showing on the console log, but don't render as a multiline on a field rendered in the control itself. Can you clarify the difference between these two lines and why the mainAddressField.value is being reformatted with commas? How do I get the control to render multiline?

2. Eliminate extraneous newlines & commas if any values were null,
If we include an addressline2, but the value is null, we'd end up with either an extra newline or comma. Rather than using the formatAddress method (which is very cool, BTW), I wrote a less flexible, but more specific method to format for US addresses which only adds line breaks and commas if the relevant values were present. It would be awesome if there were a way to merge it with the flexibility of your format string based approach, but that is a bit beyond me.

3. Add an separate zipcode extension field: Easy enough. Done.

You are a stellar leader in the community. I'm aware of some training videos you've put together and will be carving out some time to review them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant