Rah's Expanding

Rah_expanding brings dynamically expanding textareas to Textpattern CMS admin-side interfaces. With the plugin installed, textarea elements will grow with a user’s input. While the user types, the field’s height will increase to fit the content.


Version 1.3 Nov 22, 2012
Other versions...

A cup of coffee
via PayPal


Rah_expanding’s minimum requirements:

  • Textpattern 4.5.0 or newer.
  • PHP 5.2 or newer.

Supported web browsers

Rah_expanding is compatible with the following web browsers:

  • Firefox 12 and newer.
  • Internet Explorer 9 and newer.
  • Safari 5.1 and newer.
  • Chrome 14 and newer.
  • Opera 12 and newer.

Browsers that outright miss required features will gracefully fall back to normal textareas with visible scrollbars.


Rah_expanding’s installation follows the standard plugin installation steps.

  1. Download the plugin installation code.
  2. Copy and paste the installation code into the Install plugin box of your Textpattern Plugin pane.
  3. Run the automated setup.
  4. After the setup is done, activate the plugin. Done.

Admin-side textareas are now armed with the plugin’s functionality and should expand with the content.

For developers

Rah_expanding gives some additional tools for developers to play with. The plugin allows admin-side themes and plugins to set rules for the dynamic expanding textareas. Themes have the ability to limit the field’s dimensions or disable the plugin on a field basis. All this is doable with some basic styling.

CSS and field sizes

A field’s starting height is decided by a visual size set with CSS, or the actual height of the element if no CSS height is specified. The starting size used in an empty state can be set with the height CSS property.

A field’s maximum height that limits the field’s expanding, can be set with a max-height CSS property. If a textarea doesn’t have max-height, it expands all the way up to 99999 pixels.

Consider the following CSS:

	height: 1em;
	max-height: 5em;

With the above, the textarea with the ID abc_field will not get any smaller than 1em or bigger than 5em.

Disabling for a field

There are two ways to disable dynamic expanding on a field basis. Any textarea element that is armed with a class rah_expanding_disable will not be affected by the plugin.

<textarea class="rah_expanding_disable" name="foo" rows="10">
	I don't grow.

A field’s expanding can also be disabled by setting the element’s CSS property max-height to a equal or a lower value than the height.

Attaching to a textarea

By default the plugin works for textareas present on initial page load. If the DOM is modified after that and a new textarea is added, the the plugin needs to be attached to those element to take advantage of the functionality. Rah_expanding sports a familiar jQuery interface, and introduces a method named rah_expanding.


The above would attach the resizing magic to any new textarea present on the page.

Triggering resize

A textarea’s resizing can be invoked manually incase the field’s contents are changed programmatically. These type of automated changes are not otherwise tracked without the plugin being specifically informed about the change. Rah_expanding introduces a new custom event named rah_expanding_resize which can be fired using jQuery’s trigger method.


The above would update each textarea’s height.

Thanks to

Along the years rah_expanding has used and found help from few open source projects and resources.


Version 1.3 – 2012/11/22

  • Fixed: Box-sizing handling compatibility on jQuery 1.8 and newer.
  • Fixed: Workaround for a height calculation bug in Firefox on Mac OS when the field’s initial height is set as zero pixels.

Version 1.2 – 2012/09/03

  • Fixed: Text flowing workaround for Chrome. It assumably had its set of side-effects.

Version 1.1 – 2012/08/30

  • Fixed: Text flowing workaround for Chrome. Tries to improve the text wrapping of the initial textarea contents.
  • Changed: Replaced jQuery.bind method with jQuery.on.
  • Now requires Textpattern v4.5.0 or newer.

Version 1.0 – 2012/08/08

  • Changed: Now affects all admin-side textareas by default.
  • Removed: Dropped preferences panel and extra options. Slims the installation significantly.
  • Replaced Chrys Bader’s Auto Grown Textarea JavaScript solution with a fork of Jack Moore’s Autoresize.
  • Dropped support for IE6, IE7, IE8, Safari <5.1, Chrome <14, Firefox <12 and Opera <12.
  • Dropped PHP4 compatibility. Now requires PHP v5.2 or newer.
  • Is now compatible with Textpattern v4.5.0.
  • Rebranded the project as rah_expanding.

Version 0.6 – 2011/07/26

  • Added: CSRF (session riding) protection using Textpattern’s new core functions introduced in v4.4.1.
  • Fixed: only adds default definition rows to the database when plugin hasn’t been installed before, or when the old installed version was v0.4 or older.
  • Changed: set temporary version number after installer has been run. Prevents possibility of running the installer twice.
  • Now requires Textpattern version 4.4.1 or newer.

Version 0.5 – 2011/06/05

  • Added: now includes uninstaller that uses plugin-lifecycle callbacks, drops the plugin’s tables from the database when deleting the plugin.
  • Added: informs the user if updating database records failed.
  • Added: language string support. Now the interface can be translated to different languages using TextPacks.
  • Added: “Options” link to the Plugins pane.
  • Added: rah_ui class selectors to the elements, <tbody> and <thead> containers to the list table.
  • Changed: Improved JavaScript based multi-edit script.
  • Changed: During first install, set the database table’s default charset to UTF-8.
  • Changed: Only accept POSTs when saving changes. Requests send as GET are ignored.
  • Changed: shortened the admin-side step names, and renamed step form to edit.
  • Removed: replaced rah_autogrowing_textarea_check() function with new method of checking if the plugin is up-to-date. Now uses simple version number to confirm the status.
  • Removed: Some markup, left-over inline styles and pane heading.
  • Now requires Textpattern version 4.2.0 or newer for full feature support.

Version 0.4 – 2010/11/11

  • Added: now prompts users if required fields are left empty when creating new rules.
  • Interface improvements: removed unnecessary table-layouts, moved all CSS lines to <head>.
  • Changed: plugin type to the newer Admin only.
  • Changed: tries to run the installer only if there are no preferences available.
  • Changed: now uses different method for building list of available events.
  • Changed: shows events/panels label instead of name in the listings.
  • Changed: preferences pane shows multiedit controls only when something is selected. As seen in rah_post_versions.
  • Removed default values from the installer SQL.

Version 0.3.3 – 2009/06/03

  • Removed useless queries.
  • Improved callbacks.

Version 0.3.2 – 2009/02/22

  • Fixed: Removed lost child skeleton function; Fixes error: Fatal error: Call to undefined function rah_plugin_download_install().

Version 0.3 – 2009/02/21

  • Added: Admin interface under Extensions -tab.
  • Added: Able to define which textareas auto-grow.
  • Added: Max. height limit, line height and other optional style settings are now adjustable.

Version 0.2 – 2008/07/03

  • Changed line-height from EMs to pixels: fixes the small-to-smaller-by-line-to-line line-height-bug that occurs in some browsers that cause some problems with textareas.

Version 0.1 – 2008/07/03

  • First release.