Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a text field, with filtered HTML and a max length of 2500 characters. The problem is that when I count the characters numbers, it is under 2500 characters but when I want to save my node, I get an error message which says that "the value may not be longer than 2500 characters."
For a text field with filtered HTML, how characters are counted ? Are HTML tags considered as characters ?
Comments
Comment #1
rolando.isidoro CreditAttribution: rolando.isidoro commentedHi lucuhb,
I've stumbled upon the same problem you described. I looked into the CCK's source code and from what I could tell HTML tags are considered too:
To prevent this from happening a simple workaround can be implemented, just by using PHP's strip_tags function:
Even though this solves your problem, I wouldn't advise you to change the source code. Maybe we could ask for this to be an optional setting on the field definition screen, so we could op-out the HTML tags from the char limit count.
Rolando
Comment #2
lucuhb CreditAttribution: lucuhb commentedYes, this could be a good idea to have a specific parameter to define whether or not HTML tags are integrated in the character count
Comment #3
NewZeal CreditAttribution: NewZeal commentedI third this request. I don't like having to hack modules, and while cck is integrated into D7, D6 still has a lot of life left in it. OK, so I admit it, I'm hacking this module and using it on a production site :)
Comment #4
baisongAlso using this hack on a production site...