Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cftextarea validation not using trim?

Participant ,
Sep 13, 2011 Sep 13, 2011

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?!

422
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 13, 2011 Sep 13, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 13, 2011 Sep 13, 2011
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources