in my node comment form I have a 'your name' field and an 'email' field for users to fill out. They are different in length and like them both to be length '30'. How can I do this with hook_form_comment_form_alter?

I've tried this, with no success (in template.php):

$form['field_email']['#size'] = 30;
$form['author']['#size'] = 30;

I've tried just changing the size of the field for the email field in the content type comments manage fields area but it does nothing.

1 Answer 1


In the core comment form the 'author' element is an array of form elements:

  $form['author']['name']['#size'] = 30;
  $form['author']['mail']['#size'] = 30;
  • Just in addition, for @Sage to know the proper array structure. The Devel module's dsm() function could help with that too. Just for future needs. May 29, 2015 at 4:19
  • That worked after all; thanks guys! @Shawn Conn thanks as always.
    – Sage
    May 29, 2015 at 21:16

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.