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" (from r103466)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112145 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-13 03:56:05 +00:00
parent 752869e23b
commit 16f83851db

View File

@ -191,7 +191,8 @@ TreeDropdownField.prototype = {
var ajaxURL = this.buildURL('tree?forceValues=' + this.inputTag.value);
var secId = jQuery('[@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, {