83a04d4d438bd9c7f41a4228c31cdb7ea80af173
[ldapsaisie.git] / public_html / includes / js / LSformElement_textarea.js
1 var LSformElement_textarea = new Class({
2     initialize: function(){
3       this.initialiseLSformElement_textarea();
4       if ($type(varLSform)) {
5         varLSform.addModule("LSformElement_textarea",this);
6       }
7     },
8     
9     initialiseLSformElement_textarea: function(el) {
10       if (!$type(el)) {
11         el = document;
12       }
13       el.getElements('textarea.LSform').each(function(textarea) {
14         var btn = new Element('img');
15         btn.addClass('btn');
16         btn.src = varLSdefault.imagePath('clear.png');
17         btn.addEvent('click',this.onClearBtnClick.bind(this,btn));
18         btn.injectAfter(textarea);
19         varLSdefault.addHelpInfo(btn,'LSformElement_textarea','clear');
20       }, this);
21     },
22     
23     onClearBtnClick: function(btn) {
24       btn.getPrevious().value='';
25     },
26     
27     reinitialize: function(el) {
28       this.initialiseLSformElement_textarea(el);
29     }
30 });
31 window.addEvent(window.ie ? 'load' : 'domready', function() {
32   varLSformElement_textarea = new LSformElement_textarea();
33 });