inputEx - Textarea Usage

Basic Textarea creation

Use the following code to create a basic inputEx Textarea.

new YAHOO.inputEx.Textarea({parentEl: 'container1', value: 'Textarea can contain\nmultiline text !\n'});

Textarea setValue/getValue

Test of the setValue, getValue methods

var div = YAHOO.util.Dom.get('container2'); var textField = new YAHOO.inputEx.Textarea({parentEl: div, showMsg:true, required:true}); var button1 = YAHOO.inputEx.cn('button', null, null, "SetValue"); div.appendChild(button1); YAHOO.util.Event.addListener(button1, "click" ,function() { textField.setValue('Textarea can contain\nmultiline text !\n'); }); var button2 = YAHOO.inputEx.cn('button', null, null, "GetValue"); div.appendChild(button2); YAHOO.util.Event.addListener(button2, "click" ,function() { alert(textField.getValue()); });

Change Textarea size

Set the size using "rows" and "cols" attributes.

new YAHOO.inputEx.Textarea({parentEl: 'container3', value: 'Set the size...\nusing "rows" and "cols" attributes !\n', rows: 8, cols: 40});

More options

Set the min/max length, typeInvite...

new YAHOO.inputEx.Textarea({parentEl: 'container4', showMsg:true, required:true, typeInvite:"Type text here", minLength:10, maxLength:20, name: "Test4"});