Copy link to clipboard
Copied
i've tried for the first time to use cftextarea and i realized that when validating, it doesn't trim the value. what's the point in having a "required" attribute if the user can enter all blanks?!
Copy link to clipboard
Copied
Just because you can't see it, doesn't mean it's not there.
A space character is a value, just like an "a", a "1" or an "@" symbol. One space is just as much a character as a single A-Z or other "visible" character is. A dozen spaces is... well, you get the picture. But any of these values will be equally unsuitable for many purposes that simply validating for requiredness would not help.
If you need more specific validation requirements, then apply them. There are also length checks, range checks, various hard-coded data-type and pattern-matching checks, as well as regex pattern validation you can use. About the only validation it doesn't seem to offer is to supply a validation callback so one can write one's own validation rules.
What a data input control should not do automatically is to trim() the value. Leading and trailing space might be relevant: it's not for the control to determine whether it's relevant or not. That's your job.
--
Adam
Copy link to clipboard
Copied
cfinput doesn't trim the value either. If you want the values trimmed, I suggest finding a js function and incorporating it into your app.