i am trying to set a default value for the body textarea in /node/add/story, but i must understand something wrong. the title works fine...but no body default value is beeing set. any hints?

function mymodule_form_alter($form_id, &$form) {
  if ($form_id == 'story_node_form') {

// this works fine and sets the default value of title to "some title text"
    $form['title']['#default_value'] = "some title text";

// why does this not set the body default value to "some body text" ?
    $form['body']['#default_value'] = "some body text";

  }
}

Comments

tenrapid’s picture

Try the following instead:

  $form['body_filter']['body']['#default_value'] = "some body text";
doublejosh’s picture

function default_channel_body_form_alter(&$form, $form_state, $form_id) {

  drupal_set_message('working?<pre>'.print_r($form,1).'</pre>');

  if ($form_id == 'micro_post_node_form') {

    $form['body_field']['body']['#default_value'] = "#testing";

  }
}
Marko B’s picture

what is this default channel in function, where do i put this function?

Jaypan’s picture

He was showing you a function that he probably already used himself in another thread. You will need to rename the function according to the name of your module (or theme if you put it in a theme). What he showed you is an implementation of hook_form_alter().

Marko B’s picture

Thanx Jay

Was searchin for something like http://drupal.org/node/497254