add arbitrary descriptions div in a node edit or add form the need seems simple but I don't find anything about this.

I'd like to add descriptions (div class="description"), non related to specific cck fields. I though I could use these to compute informations inside it (to sum up some of the choices of tricky content types) or to show up an information when choosing a particular option (like, to show a "cck description" rather than a true cck widget when using conditionnal field).

template.php does not seems to be the right way : I got a lot of ccks, and a lot of content types, I just cant create a hook for each case I need this is not flexible enough. I suppose.

is there any 'dummy' cck field with just a description array and no widget I could use like a normal cck, and locate as any other cck in my forms ?
or : how could I write a 'cck description' module (I'm ok with php and drupal module simple setup)

Im using D6.x
it sounds like you want a custom div to show for certain form values ... or on some conditional ajaxy thing on the form ...

I would basically use hook_form_alter with a case statement probably, or some use of nested array keys to add #prefix elements into the form.

The simplest example would be:

function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id == 'my_content_type_node_add') {
    $form['field_FOO']['#prefix'] = '&lt;div class="description"&gt;a description goes here...&lt;/div&gt;';
  }
}


You said you had a million of these, all over the place ... no big deal. Somewhere in your module as a variable or tucked away in a function:

// A simple array lookup of $form_id =&gt; $fields =&gt; $descriptions ...
$descriptions_map = array(
  'my_content_type_node_add' =&gt; array(
    'field_FOO' =&gt; 'a description goes here ....',
     ),
    'field_ANOTHER_BAR' =&gt; '...',
  ),
  'some_other_content_type' =&gt; array ...,
);


Using this simple lookup table (which could help tidy up your code) ... you then make hook_form_alter use it by looking at the array keys and eventually setting form values ... I'm leaving out an ugly bit of code with for loops and calling like array_keys but ...

$form[$field_key]['#prefix'] = $field_key_description;