From 6db507ba6cd64b5922d4fc34ee77e3d95df41c43 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 6 Nov 2008 12:01:55 +0000 Subject: [PATCH] - LSformElement_select_object : Correction bugs --- .../class.LSformElement_select_object.php | 3 ++- .../js/LSformElement_select_object_field.js | 27 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/trunk/includes/class/class.LSformElement_select_object.php b/trunk/includes/class/class.LSformElement_select_object.php index 287164a3..5708b2b6 100644 --- a/trunk/includes/class/class.LSformElement_select_object.php +++ b/trunk/includes/class/class.LSformElement_select_object.php @@ -57,7 +57,8 @@ class LSformElement_select_object extends LSformElement { 'addBtn' => _('Modifier'), 'deleteBtns' => _('Supprimer'), 'multiple' => (($this -> params['multiple'])?1:0), - 'noValueLabel' => _('Aucun objet') + 'noValueLabel' => _('Aucune valeur definie'), + 'noResultLabel' => _('Aucun résultat') ) ); diff --git a/trunk/includes/js/LSformElement_select_object_field.js b/trunk/includes/js/LSformElement_select_object_field.js index a1947f31..33aae8d7 100644 --- a/trunk/includes/js/LSformElement_select_object_field.js +++ b/trunk/includes/js/LSformElement_select_object_field.js @@ -134,9 +134,20 @@ var LSformElement_select_object_field = new Class({ }, clearUl: function() { - this.ul.getElements('li.LSformElement_select_object').each(function(li){ - li.destroy(); - }); + if (this.params.multiple) { + this.ul.getElements('li.LSformElement_select_object').each(function(li){ + li.destroy(); + }); + } + else { + var a = this.ul.getElement('a.LSformElement_select_object'); + if ($type(a)) { + a.set('html',this.params.noValueLabel); + a.removeClass('LSformElement_select_object_deleted'); + var input = this.ul.getElement('input.LSformElement_select_object'); + input.value = ""; + } + } }, clearUlIfNoValue: function() { @@ -146,7 +157,7 @@ var LSformElement_select_object_field = new Class({ }, addLi: function(name,dn) { - if (this.params.multiple) { + if (this.params.multiple) { // Multiple var li = new Element('li'); li.addClass('LSformElement_select_object'); @@ -169,9 +180,9 @@ var LSformElement_select_object_field = new Class({ li.injectInside(this.ul); } - else { + else { // Non Multiple var a = this.ul.getElement('a'); - if ($type(a)) { + if ($type(a)) { // Deja initialise a.href="view.php?LSobject="+this.params['object_type']+"&dn="+dn; a.set('html',name); a.removeClass('LSformElement_select_object_deleted'); @@ -182,7 +193,7 @@ var LSformElement_select_object_field = new Class({ name: this.name+'[]' }); } - else { + else { // Non initialise (No Value) this.ul.empty(); var li = new Element('li'); @@ -361,7 +372,7 @@ var LSformElement_select_object_field = new Class({ if (!$type(this.searchAddUl.getElement('li.LSformElement_select_object_searchAdd'))) { var li = new Element('li'); li.addClass('LSformElement_select_object_searchAdd'); - li.set('html',this.params.noValueLabel); + li.set('html',this.params.noResultLabel); li.injectInside(this.searchAddUl); } },