How to use input filtering on node type with 2 textareas
Hi,
I have created a module which defines 2 textareas (see code below). I want to add input filtering to the textareas, but this doesn't seem to work.
No matter if i set the input format for a textarea to 'Filtered HTML' or not, all tags are saved identical to the input text, which contains tags that are not allowed.
Because i have 2 textareas, i had to set the $parent attribute for filter_form(), to specify which filter applies to which textarea.
Note that what i want is 2 fieldsets, each containing a textarea, and input formatting options.
Here is my implementation of hook_form():
<?php
... some other form items
$form['left_field'] = array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#attributes' => array('class' => 'left_container'),
);
$form['left_field']['left_format']['left_content'] = array(
'#type' => 'textarea',
'#title' => 'Left column',
'#rows' => 20,
'#cols' => 60,
'#required' => TRUE,
'#default_value' => $node->left_content,
);
$form['left_field']['left_format']['format'] = filter_form($node->left_format, NULL, array('left_field', 'left_format', 'left_content'));
$form['right_field'] = array(
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#attributes' => array('class' => 'right_container'),
);
$form['right_field']['right_format']['right_content'] = array(
'#type' => 'textarea',
'#title' => 'Right column',
'#rows' => 20,
'#cols' => 60,
'#default_value' => $node->right_content,
);
$form['right_field']['right_format']['format'] = filter_form($node->right_format, NULL, array('right_field', 'right_format', 'right_content'));
return $form;
?>My DB fields are set up like this:
`nid` INT UNSIGNED NOT NULL DEFAULT '0',
`vid` INT UNSIGNED NOT NULL DEFAULT '0',
`left_content` LONGTEXT NULL ,
`left_format` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
`right_content` LONGTEXT NULL ,
`right_format` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (nid, vid),The $node->left_format & $node->right_format contain the right numeric representation of the selected filter, while $node->format is 0.
What could i do to filter the input in the textarea according to the selected format?
Any help on this one?
Thanks a lot!

Nevermind... i forgot to run
Nevermind... i forgot to run the text through the check_markup function.
See http://drupal.org/node/192401#comment-656684 for more info.