H

ere are a couple of script examples you might find useful. Say you’ve got a multi-line text field or variable that contains a lot of text. To save time in scrolling (or clicking the ‘+’ icon next to the field) to see all of the text you just want to auto-expand the height of the field to fit its contents based on some other client-side trigger. Here are a couple of scripts that allow you to do that.

Expand Multi-line Height

For standard form fields (and multi-line text variables in the service catalog)…

var fieldName = 'description';
var el = g_form.getControl(fieldName);
el.style.height = el.scrollHeight + 'px';

For multi-line text variables on a standard form…

var varLabel = 'Special Requirements';
//Get the 'Variables' section
$('variable_map').up('table').select('label').each(function(elmt) {
   //Find the label for the textarea variable
   if(elmt.innerHTML == varLabel) {
      //Find the textarea and change its height to match text
      elmt.up('table').select('textarea').each(function(el) {
         el.style.height = el.scrollHeight + 'px';
      });
   }
});