mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-21 07:53:50 +01:00
LSform/LSformElement : permit form element to provide custom clean value method
This commit is contained in:
parent
881323f813
commit
78d68951e2
3 changed files with 42 additions and 29 deletions
|
@ -1,6 +1,7 @@
|
|||
var LSform = new Class({
|
||||
initialize: function(){
|
||||
this._modules=[];
|
||||
this._fields=[];
|
||||
this._elements=[];
|
||||
this._tabBtns=[];
|
||||
|
||||
|
@ -176,6 +177,16 @@ var LSform = new Class({
|
|||
}
|
||||
},
|
||||
|
||||
addField: function(name,obj) {
|
||||
this._fields[name]=obj;
|
||||
},
|
||||
|
||||
clearFieldValue: function(name) {
|
||||
if ($type(this._fields[name]) && $type(this._fields[name].clearValue)) {
|
||||
this._fields[name].clearValue();
|
||||
}
|
||||
},
|
||||
|
||||
getValue: function(fieldName) {
|
||||
var retVal = Array();
|
||||
var inputs = this.getInput(fieldName);
|
||||
|
|
|
@ -17,7 +17,7 @@ var LSformElement = new Class({
|
|||
}
|
||||
elements.each(function(li) {
|
||||
var id='LSformElement_field_'+this.name+'_'+$random(1,1000);
|
||||
this.fields[id] = new LSformElement_field(this,li,id);
|
||||
this.fields[id] = new LSformElement_field(this,li,id,this.name);
|
||||
}, this);
|
||||
},
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
var LSformElement_field = new Class({
|
||||
initialize: function(LSformElement,li,id){
|
||||
initialize: function(LSformElement,li,id,field_name){
|
||||
this.id = id;
|
||||
this.LSformElement = LSformElement;
|
||||
this.li = li;
|
||||
this.field_name = field_name;
|
||||
|
||||
if (this.LSformElement.multiple) {
|
||||
this.addFieldBtn = new Element('img');
|
||||
|
@ -36,6 +37,7 @@ var LSformElement_field = new Class({
|
|||
if ($type(this.getFormField())) {
|
||||
this.getFormField().value='';
|
||||
}
|
||||
varLSform.clearFieldValue(this.field_name);
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
|
|
Loading…
Reference in a new issue