How would I go about creating an override to change the HTML output for the 'Post new comment' form?

I want to resize the input box and remove/reword the text below that describes web addresses, HTML tags, etc. I know that this could be accomplished through the use of CSS (for resizing the input box) and the String Override module to change/remove the text, but I'd prefer to get right in there and change the HTML output. I'm hoping to learn from this example so that I can then modify more forms, but of course without touching the core.

Comments

add1sun’s picture

Learning a little FAPI can get you a long way towards form nirvana. :-) I wrote an introductory article about how to get in there and monkey with forms at http://www.lullabot.com/articles/modifying-forms-5-and-6.

Lullabot loves you | Be a Ninja, join the Drupal Dojo

Drupalize.Me, The best Drupal training, available all the time, anywhere!

mikewheaton’s picture

Thanks very much, I'll have a look at that. :)

mikewheaton’s picture

The tutorial was great and I had no problems modifying the user_edit form. However, I've been unable to make similar changes to the new comment form. Using Firebug I found that the form is "comment_form" and I added the following to template.php:

function marinelli_comment_form($form) {
	//Display all of the available array variables
	dsm($form);

	$form['comment_filter']['comment']['#title'] = t('Your comment goes here');

	// Make sure you call a drupal_render() on the entire $form to make sure you
	// still output all of the elements (particularly hidden ones needed
	// for the form to function properly.)
	$output .= drupal_render($form);
	return $output;
}

The dsm() is displaying output, so the function must be named correctly. ['account']['name']['#title'] is based on the following piece of output from the dsm() call:

    [comment_filter] => Array
        (
            [comment] => Array
                (
                    [#type] => textarea
                    [#title] => Comment
                    [#rows] => 15
                    [#default_value] => 
                    [#required] => 1
                    [#post] => Array
                        (
                        )

I've tried various other fields on this form with no luck as well. What is it I'm doing wrong here?

add1sun’s picture

I've found that in D6 when I have weird stuff happening with anything related to display that clearing the cache helps most of the time. Administer > Site configuration > Performance

Lullabot loves you | Be a Ninja, join the Drupal Dojo

Drupalize.Me, The best Drupal training, available all the time, anywhere!

mikewheaton’s picture

I'm actually using Drupal 5, and I have caching disabled under Site Configuration > Performance. I've also made sure I cleared the browser cache, restarted the WAMP server, etc. I've gone over that syntax and looked at the dsm() output of the arrays many times and don't see where my error is. Any thoughts for what I should try next?