1

What is the correct syntax to alter the size of the comment form body text area? I can't for the life of me find it in devel dpm.

$form['comment_body']....something....

1 Answer 1

1

You can use the #rows and #cols properties to define the height and width respectively:

$form['comment_body'][LANGUAGE_NONE][0]['#rows'] = 10;
$form['comment_body'][LANGUAGE_NONE][0]['#cols'] = 50;
5
  • I was looking for the size. That makes sense. I got the rows to work with $form['comment_body']['und'][0]['#rows'] = 10; but the columns I cant get to work. I have tried $form['comment_body']['und'][0]['#columns'][0] = 20; and $form['comment_body']['und'][0]['#columns'] = 20; Commented Jun 1, 2012 at 23:01
  • It's #cols, not #columns, it should probably be $form['comment_body']['und'][0]['#cols'] = 20;
    – Clive
    Commented Jun 1, 2012 at 23:03
  • That doesn't work. comment_body > und > 0 > #cols is not there. #rows is there, but not #cols. #cols is at comment_body > #cols, and it doesn't work Commented Jun 1, 2012 at 23:09
  • It's probably a CSS issue, if you look in the markup you'll see the cols attribute on the <textarea> element. Try adding .form-textarea-wrapper textarea { width: auto; } to your stylesheet, that'll override the width: 100% set in the system CSS files. If you've got a WYSIWYG editor on the comment body this probably won't work, as they tend to fill the width of their container
    – Clive
    Commented Jun 1, 2012 at 23:15
  • Here is a shot of the dpm: i.imgur.com/12nwN.png Commented Jun 1, 2012 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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