The title says all. I am converting a theme(http://drupal.org/project/CristalX4Drupal) to drupal 7, but the field subject in the comments form is too big, so i need change the "size" attribute, can you give me a sample how i can change it?
I tried:

function CristalX4Drupal_theme() {
  return array(
    'comment_form' => array(
      'arguments' => array('form' => NULL),
     ),
  );
}

function CristalX4Drupal_comment_form(&$form) {
    $form['']['subject']['#size']=10;
}

But this do not work.

Comments

yukare’s picture

May be this is not the correct way, but it works, with it i am able to change the values used in the form.
In your comment-wrapper.tpl.php (if you template does not have one, use one from bartik as sample), you can put this line:

<? $content['comment_form']['subject']['#size']=10; ?>

Soon after the start of the file, before the from is rendered. You can use a print_r($content['comment_form']); and see all values from the array, and change it to change the form display

Fernando Correa da Conceição
http://jaguaribe.net.br

hanginthere’s picture

Ihave fresh install of d7 using default batik theme and put that code it still keeps the limit at 64 chars for the subject field. Can you be more specific about what line in comment-wrapper.tpl.php to put the code in? Does anyone know how to increase the character limit in the subject field for comments? I have comment module 7.0 that comes with d7 installation. Thanks.

rory downes’s picture

I believe that the field limit is not just in the HTML generated, which this solutions solves but also the subject field definition in the database. I have seen another post saying it is defined as a Varchar 64 - sorry but I have lost that reference so cannot include it in this comment.
Rory

rory downes’s picture

I tried this method but had to modify it slightly:
$content['comment_form']['subject']['#size']=10;

I have used this with D7 and the AT theme. I intend to use it on many other fields along with the 'Mobile Detect' module to reduce the field lengths on mobiles and tablets.
Thanks
Rory