From 1293b9776a38ea4f4dcb527ffd14aac20ed9a1e1 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 16 Oct 2008 13:16:39 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSformElement=5Fpassword=20:=20=09->=20Corr?= =?UTF-8?q?ection=20des=20probl=C3=A8mes=20li=C3=A9s=20au=20changement=20d?= =?UTF-8?q?e=20type=20de=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../includes/js/LSformElement_password_field.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/trunk/includes/js/LSformElement_password_field.js b/trunk/includes/js/LSformElement_password_field.js index 2959d79f..528cd1de 100644 --- a/trunk/includes/js/LSformElement_password_field.js +++ b/trunk/includes/js/LSformElement_password_field.js @@ -33,6 +33,15 @@ var LSformElement_password_field = new Class({ this.generateBtn.addEvent('click',this.onGenerateBtnClick.bind(this)); this.generateBtn.injectAfter(this.input); } + + this.initialize_input(); + }, + + initialize_input: function() { + // Verify + if (this.params['verify']) { + this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600}); + } }, onGenerateBtnClick: function() { @@ -51,11 +60,14 @@ var LSformElement_password_field = new Class({ var data = JSON.decode(responseText); if ( varLSdefault.checkAjaxReturn(data) ) { this.input.value=data.generatePassword; - this.changeInputType(); + this.changeInputType('view'); } }, - changeInputType: function() { + changeInputType: function(state) { + if (((this.input.type=='password')&&(state=='hide'))||((this.input.type=='text')&&(state=='view'))) { + return this.input; + } if (this.input.type=='password') { var newType = 'text'; this.viewBtn.src=varLSdefault.imagePath('hide.png'); @@ -72,6 +84,7 @@ var LSformElement_password_field = new Class({ newInput.injectAfter(this.input); this.input.destroy(); this.input = newInput; + this.initialize_input(); return newInput; },