- LSformElement_text_field.js : Bouton auto-génération manuelle pour tout les

champs dont l'auro génération est configurée
This commit is contained in:
Benjamin Renard 2008-10-07 15:48:48 +00:00
parent c3a0b951f8
commit ee3f348c88

View file

@ -10,28 +10,31 @@ var LSformElement_text_field = new Class({
}, },
start: function() { start: function() {
var force=0;
if ($type(this.params)) { if ($type(this.params)) {
if (this.params.autoGenerateOnModify) { if ($type(this.params['generate_value_format'])) {
force = 1; this.format = this.params['generate_value_format'];
} this.oldBg=this.input.getStyle('background-color');
}
if ((this.input.value=='')||(force)) { this.fx = new Fx.Tween(this.input,{property: 'background-color',duration:600});
if ($type(this.params)) {
if ($type(this.params['generate_value_format'])) { // GenerateBtn
this.format = this.params['generate_value_format']; this.generateBtn = new Element('img');
this.generateBtn.addClass('btn');
this.generateBtn.src='templates/images/generate.png';
this.generateBtn.addEvent('click',this.refreshValue.bind(this));
this.generateBtn.injectAfter(this.input);
// Auto
var force=0;
if (this.params.autoGenerateOnModify) {
force = 1;
}
if ((this.input.value=='')||(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);
input.addEvent('change',this.refreshValue.bind(this)); input.addEvent('change',this.refreshValue.bind(this));
},this); },this);
this.oldBg=this.input.getStyle('background-color');
this.fx = new Fx.Tween(this.input,{property: 'background-color',duration:600});
this.generateBtn = new Element('img');
this.generateBtn.addClass('btn');
this.generateBtn.src='templates/images/generate.png';
this.generateBtn.addEvent('click',this.refreshValue.bind(this));
this.generateBtn.injectAfter(this.input);
} }
} }
} }