Lang file : Update lang french file
[ldapsaisie.git] / trunk / includes / js / LSformElement_field.js
1 var LSformElement_field = new Class({
2     initialize: function(LSformElement,li,id){
3       this.id = id;
4       this.LSformElement = LSformElement;
5       this.li = li;
6       
7       if (this.LSformElement.multiple) {
8         this.addFieldBtn = new Element('img');
9         this.addFieldBtn.src = varLSdefault.imagePath('add.png');
10         this.addFieldBtn.addClass('btn');
11         this.addFieldBtn.addEvent('click',this.LSformElement.onAddFieldBtnClick.bind(this.LSformElement,this));
12         this.addFieldBtn.injectInside(this.li);
13         varLSdefault.addHelpInfo(this.addFieldBtn,'LSform','addFieldBtn');
14         
15         this.removeFieldBtn = new Element('img');
16         this.removeFieldBtn.src = varLSdefault.imagePath('remove.png');
17         this.removeFieldBtn.addClass('btn');
18         this.removeFieldBtn.addEvent('click',this.LSformElement.onRemoveFieldBtnClick.bind(this.LSformElement,this));
19         this.removeFieldBtn.injectInside(this.li);
20         varLSdefault.addHelpInfo(this.removeFieldBtn,'LSform','removeFieldBtn');
21       }
22     },
23     
24     getFormField: function() {
25       if ($type(this._formField)) {
26         return this._formField;
27       }
28       this._formField = this.li.getFirst('input');
29       if(!$type(this._formField)) {
30         this._formField = this.li.getFirst('textarea');
31       }
32       return this._formField;
33     },
34     
35     clearValue: function() {
36       if ($type(this.getFormField())) {
37         this.getFormField().value='';
38       }
39     },
40     
41     remove: function() {
42       this.li.destroy();
43     }
44 });