-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
We do have the form types text
and textarea
and in Doctrine the field types text
and string
.
If you use a string/text you usually expect some data but not special characters like a line feed.
This is no problem if you use the form component since you cannot enter a line feed in the input field.
If you however develop an API then you might get such unwanted characters in e.g. the name or
the street.
Should we add a validation constraint Text? It could have some defaults to disallow some special characters and options to customize that behavior?
With this we can support the developer to have a more consistent database without the hassle of adding an Regex validator.
I think at least double spaces and line breaks should be invalidated. I was using for this /(\s\s)|(\n)/
so far.
What do you think - Does this make sense? What should be invalidated?