Forums / Developer / Limit textlength in OE?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Limit textlength in OE?

Author Message

Nicklas Lundgren

Wednesday 10 December 2003 12:29:50 am

Hi,
I have a problem that I suppose a few others has hade before.

I am using the article class to publish news. However, I would like to limit the size of the Intro xml-textfield to 200 characters.

The article class has no property for max textlength. And I cant find any immediate way to customize the OE to do what I want.

Any ideas on how to accomplish this? It is of course important that the user gets a message when the limit is reached.

All ideas greatly appreciated!

Kind regards,
Nicklas Lundgren

Marco Zinn

Wednesday 10 December 2003 12:44:23 pm

Hm... will be difficult...
What do you want to count? The characters in the XML field (including the XML tags)? Or the "rendered" characters? Or the rendered HTML?
I suggest, that you don't limit the field for now, but -if you want to make sure, that noone messes your site up with long intros- use a string operator to limit the intro DISPLAY ("shorten")

Marco
http://www.hyperroad-design.com

Nicklas Lundgren

Wednesday 10 December 2003 1:07:24 pm

Hi all,
Thanks Marco, for your reply.

However, i digged into the code of the OE today, and have managed to add a small counter to the statusbar.

I have made a new ini-file to the OE, maxlength.ini in which I define which parentnodes the restiction should apply to. Also I there state the textlength allowed, and wether it should apply to the "intro" or the "body" field.

It works!

I use textRanges in javascript to prevent the xml-fields from expanding.

Regards,
Nicklas Lundgren