mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 11:52:59 +01:00
LSformElement_text : Fixed bugs in auto-generation processus
This commit is contained in:
parent
e60ba7ee61
commit
3a1392f4b7
1 changed files with 10 additions and 7 deletions
|
@ -6,8 +6,8 @@ var LSformElement_text_field = new Class({
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.params = varLSdefault.LSjsConfig[this.name];
|
this.params = varLSdefault.LSjsConfig[this.name];
|
||||||
this._auto=1;
|
this._auto=1;
|
||||||
this.input.addEvent('change',this.unauto.bind(this));
|
|
||||||
this.onChangeColor = '#f16d6d';
|
this.onChangeColor = '#f16d6d';
|
||||||
|
this.generatedValue = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
|
@ -34,7 +34,12 @@ var LSformElement_text_field = new Class({
|
||||||
if (this.params.autoGenerateOnModify) {
|
if (this.params.autoGenerateOnModify) {
|
||||||
force = 1;
|
force = 1;
|
||||||
}
|
}
|
||||||
if (((this.input.value=='')&&(this.params.autoGenerateOnCreate))||(force)) {
|
this.isCreation = false;
|
||||||
|
if (input.value=="") {
|
||||||
|
this.isCreation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((this.isCreation)&&(this.params.autoGenerateOnCreate))||(force)) {
|
||||||
this.dependsFields = this.parent.getDependsFields(this.format);
|
this.dependsFields = this.parent.getDependsFields(this.format);
|
||||||
this.dependsFields.each(function(el) {
|
this.dependsFields.each(function(el) {
|
||||||
var input = this.parent.getInput.bind(this.parent)(el);
|
var input = this.parent.getInput.bind(this.parent)(el);
|
||||||
|
@ -58,7 +63,7 @@ var LSformElement_text_field = new Class({
|
||||||
if (force==true) {
|
if (force==true) {
|
||||||
this._auto=1;
|
this._auto=1;
|
||||||
}
|
}
|
||||||
if ((this._auto)||(force==true)) {
|
if (((this._auto)||(force==true))&&((this.generatedValue=="")||(this.generatedValue==this.input.value)||(force==true))) {
|
||||||
var val=getFData(this.format,this.parent,'getValue');
|
var val=getFData(this.format,this.parent,'getValue');
|
||||||
if ($type(this.params['withoutAccent'])) {
|
if ($type(this.params['withoutAccent'])) {
|
||||||
if(this.params['withoutAccent']) {
|
if(this.params['withoutAccent']) {
|
||||||
|
@ -81,12 +86,10 @@ var LSformElement_text_field = new Class({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.input.value = val;
|
this.input.value = val;
|
||||||
|
this.generatedValue = val;
|
||||||
this.fx.start(this.onChangeColor);
|
this.fx.start(this.onChangeColor);
|
||||||
(function() {this.fx.start(this.oldBg);}).delay(1000,this);
|
(function() {this.fx.start(this.oldBg);}).delay(1000,this);
|
||||||
|
this.input.fireEvent('change');
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
unauto: function() {
|
|
||||||
this._auto=0;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue