Community & Support

Form API: #type textarea and plain-text format?

Hi

Is there a way to declare a form element of #type textarea to use only plain-text editor and NOT present fckeditor?

The styling is currently as follows by default when using #type textarea, because I do have fckeditor module installed:

<textarea class="form-textarea resizable fckeditor fckeditor-processed textarea-processed" id="edit-body" name="body" rows="2" cols="60" style="display: block;"/>

Thanks

Jeff in Seattle

Comments

Found answer...

Not documented within Form API reference:
http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6

Set form element with: '#wysiwyg' => false, and this will disable any WYSIWYG editor like FckEditor.

For example:

<?php
    $form
['body'] = array(
     
'#type' => 'textarea',
     
'#title' => $title,
     
'#wysiwyg' => false,
    );
?>

Cheers

Jeff in Seattle

Jeff in Seattle

form_alter solution

I needed to remove TinyMCE from the comments field. I couldn't get the above solution to work, but I had a custom module set up with a form_alter function.

<?php
function my_module_form_alter($form_id, &$form) {
  if (
$form_id['#id'] == 'comment-form') {
 
$form_id['comment_filter']['format'] = array();
  }
}
?>

I've posted more details and discussion on why I chose this method on my blog.

Better to use #wysiwyg

I tried your method, but then the form got too wide and couldn't fit into my panel. Instead I used this

<?php
function alterforms_form_alter(&$form, $form_state, $form_id) {
  switch (
$form_id) {
  case
'comment_form':
   
$form['#wysiwyg'] = false;
  break;
}
?>

I tried to this by overriding in template.php but that didn't work.

UPDATE:
This didn't work after all, it was just not loading the editor for some other reason. Is there a way to disable wysiwyg the way I tried, not just clearing the array completely?

Editor in Form textarea

Did u find a solution to this.

The textarea in my form shows CKEditor fields and I just want it to be a plain text area box.

Pulling my hair out over this one.

John
jebernier@gmail.com

nobody click here