Disable Drupal's resizable textarea

In Drupal, you can resize textarea but it's only useful with CSS 2.1. Now textarea can be resized easily with help from CSS3 which is supported in all modern browsers. To disable all resizable textareas, add the following code to the template.php file (which is placed in your theme folder):

Drupal 6

function yourthemename_textarea($element)  {
  $element['#resizable'] = false;
  return theme_textarea($element);  

Drupal 7

Override of theme('textarea'):

function yourthemename_textarea($variables) {
  $element = $variables['element'];
  $element['#attributes']['name'] = $element['#name'];
  $element['#attributes']['id'] = $element['#id'];
  $element['#attributes']['cols'] = $element['#cols'];
  $element['#attributes']['rows'] = $element['#rows'];
  _form_set_class($element, array('form-textarea'));

  $wrapper_attributes = array(
    'class' => array('form-textarea-wrapper'),

  // Add resizable behavior.
  if (!empty($element['#resizable'])) {
    $wrapper_attributes['class'][] = 'resizable';

  $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
  $output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
  $output .= '</div>';
  return $output;

Remember to clear your cache. Your textareas should now have no resize functionality.

To clear cache in Drupal 6, go to yourdomain.com/admin/settings/performance, and in Drupal 7: yourdomain.com/admin/config/development/performance

Related post

Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.