Closed (works as designed)
Project:
Name Field
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2021 at 14:00 UTC
Updated:
15 Apr 2025 at 15:30 UTC
Jump to comment: Most recent
Comments
Comment #2
alan d. commentedNote feature request rather than bug report as Drupal doesn't trim form values by default ;)
Does Trim work with the Name fields? (https://www.drupal.org/project/trim)
Comment #3
mohit.bansal623 commentedThe creator already updated the patch and it is passed, do we need to add something in this need more information, trim() is a php function which will work in all cases.
Comment #4
alan d. commentedThe functionality is non-standard Drupal which was the point I was making. I definitely didn't confuse the Trim module with the PHP trim() function if that was what you were implying! There is a core issue from a million years ago (cough 2006) that covers this in text fields but it still hasn't made it into core.
Do we make the module work in a sane but non-standard way?
Comment #5
promesI didn't know this core issue. Thanks for your explanation.
Comment #6
alan d. commentedWorthy feature if Trim module doesn't work. Either we should look at compatibility with that module or make this as a new feature :)
Comment #7
promesI think a new feature is ok. Up till the core patch is ready. Afterwards switch.
But then I recommend also to trim the resulting components before storing them in function massageFormValues() in src\Plugin\Field\FieldWidget\NameWidget.php: just a simple loop before the return statement:
Maybe there are more places...
Comment #8
bluegeek9 commentedDrupal core does not trim field values. This can be done with others modules like Trim