Wysiwyg mo editor for Drupal 5 forms (Form API): How to enable it for several textareas?

302 views Asked by At

I am trying to create a form with the Drupal 5 form API that has two textareas, both of which should have have a wysiwyg editor enabled to allow HTML formatted input. However, only the second textarea has the editor enabled, the other one displays the "Input format selector", but not the editor controls. I have tried this with TinyMCE 3.3.9.3 and 3.3.9.4b and CKEditor 3.5.1.6398 both using the wysiwyg module integration, the result in both cases is the same.

In this related question it is mentioned that there might be a problem of identical IDs. I have no clue how to transfer this solution to the Drupal Form API, since I gave the two fields different names. In the generated HTML, they have separate HTML ids based on the Drupal names I assigned.

The code I used to create the text areas is the following:

$form['oos'] = array(
    '#tree' => false,
);

$form['oos']['oosmessage'] = array(
    '#description' => t('Something'),
    '#title' => t('Generic out of stock message'),
    '#type' => 'textarea',
);

$form['oos']['format'] = filter_form(1, 20, array('format'));

$form['oosmd'] = array(
    '#tree' => false,
);

$form['oosmd']['oosmessage_date'] = array(
    '#type' => 'textarea',
    '#title' => t('Out of stock message until a specific date'),
    '#description' =>t('Something else.'),
);
$form['oosmd']['format'] = filter_form(1, 20, array('format'));

Thanks!

Ellen

1

There are 1 answers

8
Thariama On

Try to give the two textareas different ids and see if that works.