1

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?

2

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 '15 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 '15 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 '15 at 9:03
1

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.

1

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

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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