I have a content type with a title that shouldn't be more then 10 characters long. This title field is read only.

What is the recommended way to limit the length of that title to 10 long?


4 Answers 4


Try Maxlength module to do this.

Maxlength allows you to set maximum length of any field on any form making use of the form API. This includes fields created using the UI. (Example: any text field on a node) In D6 Maxlength allows you to set maximum lengths to the body, title and CCK textfields of any content type (node).

When the maximum length is enforced for a field, while editing content of that type some Java Script will countdown how many characters are left, also if the Javascript is turned off, it falls back to form API validation.

Automatic Nodetitles : I haven't try this. Try once, hope this module solve your issue.

"auto_nodetitle" is a small and efficient module that allows hiding of the content title field in the form. To prevent empty content title fields one can configure it to generate the title by a given pattern.

  • maxlength doesn't allow to edit the node title length.I shouldn't hide the title cause It's the most important element in this content type, and the customer will be able to add the contents.
    – learner123
    May 25, 2015 at 14:14
  • 1
    I didn't try this, but if maxlength doesn't allow to edit the node title length, turn your title into a field first with the Title project then maxlength should do the job as on any other field
    – Kojo
    May 25, 2015 at 17:57
  • @Kojo its seems a good solution for my usecase, even if I fixed my issue by using field validation.Thank you
    – learner123
    May 26, 2015 at 9:03

As per my comment to Nishan's answer :

if it it not possible to edit the node title length with Maxlength module, you can turn your content type nodes titles into regular UI fields first with the Title project.

Then Maxlength module should do the same job as on any other field.

  • Note: Title project has Not support for Drupal 8
    – Carlos
    Nov 19, 2020 at 18:29

There is now a module available that provide min/max character and word length options. It's called Node Title Validation and allows you to customize the title attributes for each Content Type independently.

Node Title Validation Settings Page


I found a solution with a sub module called Property Validation in the field validation module, after reading this comment.
And I added a jquery line to resize the node title.

    $('.page-node-add-conteneur #edit-title').attr('size',10);  

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.