From deb038ad2f5370c2e8b938528fb87d1bdbcaab5c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 14 Apr 2010 02:22:37 +0000 Subject: [PATCH] BUGFIX: fallback for changes in r98101, required if TreeDropdownField is used in a widgetarea, and does not know its field (from r98671) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102777 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/TreeDropdownField.php | 2 +- javascript/TreeSelectorField.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index e37da95e3..d0c521a0a 100755 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -113,7 +113,7 @@ class TreeDropdownField extends FormField { array ( 'id' => "TreeDropdownField_{$this->id()}", 'class' => 'TreeDropdownField single' . ($this->extraClass() ? " {$this->extraClass()}" : ''), - 'href' => $this->Link(), + 'href' => $this->form ? $this->Link() : "", ), $this->createTag ( 'input', diff --git a/javascript/TreeSelectorField.js b/javascript/TreeSelectorField.js index ca50464ad..5b3cac7d3 100755 --- a/javascript/TreeSelectorField.js +++ b/javascript/TreeSelectorField.js @@ -60,6 +60,7 @@ TreeDropdownField.prototype = { // Build a URL from the field's base URL and the given sub URL buildURL: function(subURL) { var baseURL = jQuery(this).attr('href'); + if (!baseURL) baseURL = this.ownerForm().action + '/field/' + this.getName() + '/'; var subHasQuerystring = subURL.match(/\?/); if(baseURL.match(/^(.*)\?(.*)$/)) {