I would like to customise the author textfield and subject textfield for the comment form - just adjust the size of the textfield. (eg The subject box is too short)
I would have thought this would be simple but I can't edit the fields under content type -> comment fields.
If I create new fields how do I ensure the old author and subject fields aren't displayed?
Is there a way to do this?

Comments

enzipher’s picture

Hi there,

Your best bet would be to style the form with a bit of CSS, something like:

#comment-form .form-item-name {
  width: 300px;
}

Note that this changes the author field on all comment forms. You can find the classes for the elements if you look at the HTML source code, using "Inspect element" in Firefox or Chrome for instance.

Cheers,

--

hook_world() is broken.

LTech’s picture

Thanks that worked for the name field.
I tried using firebug:
#comment-form .form-item-subject to edit the width of the subject field but I couldn't get it to work.
Would you know what I should use to edit the subject. My site is http://jspca.org.il/en/content/mae#comments
thanks again for your help.

enzipher’s picture

The .form-item-name class is actually for the field wrapper, and the actual field is 90% of the width you set on the wrapper. So better would be to set the size directly on the form element which always has the class of .form-text for text fields. In that way the textfield get the exact size you specify.

This code should work fine:

#comment-form .form-item-name .form-text,
#comment-form .form-item-subject .form-text {
    width: 160px;
}

Here you target the comment form, then the wrapper div, then the actual field. Both at the same time, which means they will get the same size. If you want them to have different size you can do:

#comment-form .form-item-name .form-text {
  width: 160px;
}
#comment-form .form-item-subject .form-text {
  width: 200px;
}

Cheers,

--

hook_world() is broken.

LTech’s picture

Thanks, it worked great.
One more question... how do I make the text box for the comment body section narrower so the text area is the same width as the box (so you don't need to move the runner arrow at the bottom of the text box when you reach near the end of a line)? Like the comment box here on drupal.org.
Thanks

enzipher’s picture

It looks like you have the "Use theme CSS" selected on the CKEditor settings page. I suggest you change that to "CKEditor default". Including the theme css (style.css) can cause a lot of strange layout issues for the editor.

Cheers,

--

hook_world() is broken.

LTech’s picture

solved. Thanks a mil I never would have guessed that.

enzipher’s picture

You are welcome! Glad it worked out for you.

--

hook_world() is broken.