From 68d2d9977f9cdb015058dd9025d7a1a80ceb7dcc Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 4 Nov 2008 13:30:17 +0000 Subject: [PATCH] =?UTF-8?q?-=20LSform=20:=20=09->=20Correction=20des=20tem?= =?UTF-8?q?plates=20(balise=20)=20=09->=20JS=20:=20D=C3=A9select?= =?UTF-8?q?ion=20des=20onglets=20lors=20du=20clique=20et=20tentative=20de?= =?UTF-8?q?=20focus=20sur=20le=20=09=09=20premier=20champs=20du=20formulai?= =?UTF-8?q?re.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/includes/js/LSform.js | 19 ++++++++++++++++++- trunk/templates/default/LSform.tpl | 2 +- trunk/templates/default/LSform_view.tpl | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/trunk/includes/js/LSform.js b/trunk/includes/js/LSform.js index a4bfceb7..a35dad54 100644 --- a/trunk/includes/js/LSform.js +++ b/trunk/includes/js/LSform.js @@ -43,7 +43,9 @@ var LSform = new Class({ onTabBtnClick: function(event,li) { if ($type(event)) { - new Event(event).stop(); + event = new Event(event); + event.stop(); + event.target.blur(); } if (this._currentTab!='default_value') { @@ -61,7 +63,22 @@ var LSform = new Class({ li.addClass('LSform_layout_current'); var div = $$('div.LSform_layout[title='+this._currentTab+']'); if ($type(div)) { + div = div[0]; div.addClass('LSform_layout_current'); + + // Focus + var ul = div.getElement('ul.LSform'); + if ($type(ul)) { + var el = ul.getElement('input'); + if (!$type(el)) { + el = ul.getElement('textarea'); + } + if ($type(el)) { + if(el.type!='hidden') { + el.focus(); + } + } + } } }, diff --git a/trunk/templates/default/LSform.tpl b/trunk/templates/default/LSform.tpl index 23c908cf..bcdd75a3 100644 --- a/trunk/templates/default/LSform.tpl +++ b/trunk/templates/default/LSform.tpl @@ -11,7 +11,7 @@ {foreach from=$LSform_layout item=tab key=tab_key} - +

{$tab.label}

{if $LSformElement_image!='' && $tab.img==1} diff --git a/trunk/templates/default/LSform_view.tpl b/trunk/templates/default/LSform_view.tpl index 598ff351..2bbea67e 100644 --- a/trunk/templates/default/LSform_view.tpl +++ b/trunk/templates/default/LSform_view.tpl @@ -11,7 +11,7 @@ {foreach from=$LSform_layout item=tab key=tab_key} - +

{$tab.label}