Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The list of recipient emails on admin/structure/contact
requires the use of commas to separate them. This results in an error if you try entering them using new lines instead.
Screenshot of current state:
Screenshots of proposed change
change listing to "each on new line"
List with bullets
Small screen (recipients are hidden)
Comment | File | Size | Author |
---|---|---|---|
#86 | contact_forms_ux-267492-86.patch | 10.2 KB | AJV009 |
#84 | contact_forms_ux-267492-84.patch | 10.2 KB | AJV009 |
#82 | contact_forms_ux-267492-82.patch | 10.18 KB | AJV009 |
#76 | Screen Shot 2020-09-02 at 1.02.14 pm.png | 31.71 KB | pameeela |
#76 | Screen Shot 2020-09-02 at 1.02.00 pm.png | 39.43 KB | pameeela |
Issue fork drupal-267492
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
Dave ReidPatch attached for review.
Comment #2
mcrittenden CreditAttribution: mcrittenden commentedPatch does a good job fixing the issue at admin/build/contact but the list still fails to wrap at admin/build/contact/edit/%n ...we either need to also fix the issue there or change that textarea to a text input (no point in having a textarea when everything's being put on one line).
Comment #3
Dave ReidI'm thinking that we should probably do it the Drupal(tm) way and have them list e-mail address, one per line instead of separated by commas with no spaces. That's just silly.
Comment #4
Dave ReidRevised patch that uses newlines instead of commas. Don't have time to test the upgrade path, but will check tomorrow. Peer review welcomed.
Comment #6
Dave ReidComment #7
Jody LynnI rerolled it
Comment #8
mcrittenden CreditAttribution: mcrittenden commentedDoes this need to be pushed to 8.x now?
Comment #9
joachim CreditAttribution: joachim commentedPerhaps Dave Reid's patch to do it the Drupal(tm) way has to be pushed to 8, but we still need to fix the output bug for 7. Ironic that the Drupal way is not the Drupal way ;)
Comment #10
joachim CreditAttribution: joachim commentedChanging version.
Comment #11
kscheirer#7: 267492-7.patch queued for re-testing.
Comment #13
mgiffordComment #14
andypostadded screenshots
Comment #15
andypostno update of config needed, so just testing coverage
Patch makes edit form better
Comment #16
andypostAnd iteration on list builder, each recipient is valid email so safe markup is unneded
Comment #18
andypostAnd added to hide column on small screens
Comment #19
andypostFix tests
Comment #21
andypostImproved list builder to not render list if there's only one recepient and display "No recipients" for empty list
Comment #24
andypostFix tests
Comment #25
mgiffordThis seems to work now as described with the line breaks.
I wonder if it would be useful to filter for comma's - given that we used to be able to use them ",". They could be just stripped out, right?
More importantly, it would be useful to strip out blank lines (especially the final one). Kinda annoying to be tripped up because of a blank line return.
Thanks for pushing this ahead @andypost - I modified the summary a bit to reflect the new URL.
Comment #26
andypost@mgifford there's no way to have blank lines, do you mean that?
looks that needs test or separate issue because currently you can't enter
my@gmail.com, , my@mail.ru
Comment #27
larowlanPatch looks good, but we need an update hook to migrate the config from , separated to "\n"
Comment #28
larowlanActually @andypost pointed out they're stored as an array, so no need for the update hook - nice
Comment #29
andypostYep, no upgrade path needed.
Looks having empty lines needs more tests, to make sure that mail send allows empty recipients (
, , ,
)Comment #30
mgifford@andypost - I was more worried about having an empty line break at the end of a list of emails. I tested drupal without the patch and
my@gmail.com, my@mail.ru,
fails too, which is the same problem.I can set up a different issue though to deal with this as well as
my@gmail.com \n my@mail.ru \n
&my@gmail.com \n \n my@mail.ru
Comment #31
mgiffordComment #32
andypostNeeds re-roll after #2557577: Use comma separated item list in contact listing and remove a SafeMarkup::checkPlain()
Comment #33
andypostre-roll + render one item with
$row['recipients']['data']['#markup'] = $recipients[0];
Comment #34
andypostmaybe better to sort emails before display?
Comment #35
andypostClean-up, now listing displayed fine so let's keep the comma list
Comment #38
MykolaBova CreditAttribution: MykolaBova as a volunteer commentedre-roll
Comment #39
MykolaBova CreditAttribution: MykolaBova as a volunteer commentedComment #40
andypostStill needs usability review
Comment #41
m1r1k CreditAttribution: m1r1k at Propeople (now part of FFW) for Propeople (now part of FFW) commentedPlease, do not save empty "recipients" lines into storage only to provide way to group them.
Comment #42
andypostfor #41
Comment #43
Bojhan CreditAttribution: Bojhan commentedLooks good to me, what needs review here?
Comment #44
id.tarzanych CreditAttribution: id.tarzanych commentedAdded empty lines removal
Comment #45
id.tarzanych CreditAttribution: id.tarzanych commentedComment #46
id.tarzanych CreditAttribution: id.tarzanych commentedOptimized code a bit.
Comment #50
andypostThat will fail
Value array ( 0 => 'simpletest&@example.com', 2 => 'simpletest2@example.com', ) is equal to value array ( 0 => 'simpletest&@example.com', 1 => '', 2 => 'simpletest2@example.com', ).
because there's a test for empty lines
Also you have to set the value back to form state to allow other validation to work with cleaned values, also that's require a short comment
array_filter() is not needed if validation clean-ups the empty lines
Comment #52
id.tarzanych CreditAttribution: id.tarzanych commentedFixed test cases, removed extra array_filter
Comment #53
id.tarzanych CreditAttribution: id.tarzanych commentedComment #56
madhavvyas CreditAttribution: madhavvyas as a volunteer and at CIGNEX commentedComment #57
madhavvyas CreditAttribution: madhavvyas as a volunteer and at CIGNEX commentedPatch re rolled #52
Comment #58
Marcus Maihoff CreditAttribution: Marcus Maihoff commentedThis patch should fix the inline list-items to a block element.
Comment #60
fil00dl CreditAttribution: fil00dl at Skilld commentedIt's not possible to validate all emails on the same line, separate by spaces or commas.
The instruction “To specify multiple recipients, separate each email address on a new line” works well.
But the result is not perfect :
Each email (on a new line) is between two symbols (a dot and a comma). Maybe only just the dot will be enough ?
Moreover there is no filter to check if an address is duplicated
So the issue needs works
Comment #61
madhavvyas CreditAttribution: madhavvyas as a volunteer commentedComment #62
madhavvyas CreditAttribution: madhavvyas as a volunteer commentedPatch re-rolled #58
Comment #63
madhavvyas CreditAttribution: madhavvyas as a volunteer commentedComment #66
madhavvyas CreditAttribution: madhavvyas as a volunteer commentedPatch re rolled as per comment #57
Comment #60 task is pending
Comment #68
andypostComment #70
jibranPlease update the issue summary.
These changes are not needed.
Comment #76
pameeela CreditAttribution: pameeela commentedUpdated the IS to reflect the current state. I tested and the spaces issue does not occur anymore on 9.0.3, at least from what I can tell? Tested entering a long list of emails without spaces and spaces get added on save. It works fine at various screen sizes. (Although a very long email address still breaks mobile, so the fact that the patch hides the column on mobile is good).
Do we still want to update this so that you can use newlines instead of commas? It would address this issue #3111336: comma separated list of recipients is not working.
No spaces:
After save:
Comment #78
AJV009Comment #79
AJV009Re rolled to 9.2.x
Comment #80
AJV009Comment #81
AJV009Previously had wrong version, just switched to 9.2 and confirmed
Please check the changes ->
Comment #82
AJV009fixed some coding standard issues
Comment #84
AJV009Fixed some more bugs
Comment #86
AJV009Comment #90
smustgrave CreditAttribution: smustgrave at Mobomo commentedSeems. the config is not updated after updating the form.
Comment #91
pameeela CreditAttribution: pameeela commentedComment #92
pameeela CreditAttribution: pameeela commentedDiscussed with @Lendude in Slack, there doesn't seem to be any bug here. The form works as described.
If adding the email addresses on new lines is strongly desirable, let's open a new feature request with the details and the reasoning. This issue is so old, it's best to close it to avoid confusion.