You can either use regex to do the validation or change that text area to input and ask for a comma delimiter between words.
Feb 7, 2020
5
Level 12
Textarea validation problem with max, because of \r\n
After a lot of time, I found out that max validation makes problems, when I have an textarea. For example I write this:
Hello
World
This should be 10 chars. But Laravel says its 11. The Problem is that i have set maxlength to the textarea field to 10. And also the validation for max is 10. I type in the whole text with 10 chars and get an error. Because laravel seems to add for each break an \r\n (with an empty space at the end. I mean "\r\n "). I think this could be the problem. But what could I do? I found a lot for replace stuff at google but this all does not help. The \r\n is still there.
Please or to participate in this conversation.