diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index 34bf57f22..2f9f5d623 100644 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -213,8 +213,7 @@ class TreeDropdownField extends FormField { $properties, array( 'Title' => $title, - 'TitleURLEncoded' => rawurlencode($title), - 'Metadata' => ($metadata) ? Convert::raw2att(Convert::raw2json($metadata)) : null + 'Metadata' => ($metadata) ? Convert::raw2json($metadata) : null, ) ); diff --git a/javascript/TreeDropdownField.js b/javascript/TreeDropdownField.js index c0e452a8c..c30e67a2c 100644 --- a/javascript/TreeDropdownField.js +++ b/javascript/TreeDropdownField.js @@ -56,7 +56,7 @@ var linkTitle = strings.openLink; if(linkTitle) this.find("treedropdownfield-toggle-panel-link a").attr('title', linkTitle); - if(this.data('title')) this.setTitle(decodeURIComponent(this.data('title'))); + if(this.data('title')) this.setTitle(this.data('title')); this.getPanel().hide(); this._super(); @@ -138,10 +138,10 @@ this[this.getPanel().is(':visible') ? 'closePanel' : 'openPanel'](); }, setTitle: function(title) { - if(!title) title = strings.fieldTitle; + title = title || this.data('title') || strings.fieldTitle; this.find('.treedropdownfield-title').html(title); - this.data('title', encodeURIComponent(title)); // separate view from storage (important for search cancellation) + this.data('title', title); // separate view from storage (important for search cancellation) }, getTitle: function() { return this.find('.treedropdownfield-title').text(); diff --git a/templates/forms/TreeDropdownField.ss b/templates/forms/TreeDropdownField.ss index 016acee33..8b37d2f2b 100644 --- a/templates/forms/TreeDropdownField.ss +++ b/templates/forms/TreeDropdownField.ss @@ -1,8 +1,8 @@
title="$Description"<% end_if %> - <% if $Metadata %>data-metadata="$Metadata"<% end_if %>> - + data-title="$Title.ATT" + <% if $Description %>title="$Description.ATT"<% end_if %> + <% if $Metadata %>data-metadata="$Metadata.ATT"<% end_if %>> +