From ac2d9b35c03556eb28231671b84317468eb8ae65 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Mon, 26 Apr 2010 03:01:00 +0000 Subject: [PATCH] ENHANCEMENT: make the getTree ajax call more generic so it get local from its containing form, rather than hard-coded "Form_EditForm_Locale" cos the field is not only used in "EditForm" git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@103466 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/TreeSelectorField.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/javascript/TreeSelectorField.js b/javascript/TreeSelectorField.js index f981a0151..60821ea00 100755 --- a/javascript/TreeSelectorField.js +++ b/javascript/TreeSelectorField.js @@ -191,7 +191,8 @@ TreeDropdownField.prototype = { var ajaxURL = this.buildURL('tree?forceValues=' + this.inputTag.value); var secId = jQuery(':input[name=SecurityID]'); ajaxURL += secId.length ? '&SecurityID=' + secId.val() : ''; - if($('Form_EditForm_Locale')) ajaxURL += "&locale=" + $('Form_EditForm_Locale').value; + var localeField = jQuery(this.ownerForm()).find(':input[name=locale],:input[name=Locale]'); + if(localeField.length) {ajaxURL += "&locale=" + localeField.val();} if(this.inputTag.value) ajaxURL += '&forceValue=' + this.inputTag.value; if(this.search() != null) ajaxURL += "&search=" + this.search(); new Ajax.Request(ajaxURL, {