1

On the left column on http://ruh.kz, you can the output of the Microblog module. This module uses the node title as a microblog entry; the maximum length of the title is by default 255 characters. In a microblog.module I've made the following changes:

function microblog_form(&$node) {
  $type = node_get_types('type', $node);

  $form['title'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($type->title_label),
    '#rows' => 4,
    '#cols' => 30,
    '#required' => TRUE,
    '#maxlength' => 500,
  );

  return $form;
}

Now, when I'm typing, it shows only 450 characters or less. Why it happens?

2

The title column of the {node} table is limited to 255 characters. Just because you change it in the UI doesn't mean that it can be saved like that in the database, unless you mess around with the database schema manually (and you should not do that).

I am not sure why that module is exposing itself as a node type, sounds rather strange to me. The only reason I can imagine is being able to rely on the node access system. But nodes are a rather heavy thing, there is a lot of overhead that seems unecessary to me for this use case.

| improve this answer | |
  • u mean that module should not use node system? What's ur email, berdir. Want to discuss with you about your paid services :) – Alexander Kim Jun 22 '11 at 11:44
  • By the way, when you press "Сохранить" its "Save" on english → there's acting some kind of javascript - because it adds your microblog entry without reloading whole page. – Alexander Kim Jun 22 '11 at 11:49
1

Textareas do not support the #maxlength attribute see here, and also here.

As for why it's only showing 450 characters I'm not sure. Is there any JavaScript running from that module that restricts the amount of characters?

| improve this answer | |

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.