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.


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

  $form['author']['name']['#size'] = 30;
  $form['author']['mail']['#size'] = 30;
|improve this answer|||||
  • 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. – Leolando Tan May 29 '15 at 4:19
  • That worked after all; thanks guys! @Shawn Conn thanks as always. – Sage May 29 '15 at 21:16

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.