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
This commit is contained in:
Normann Lou 2010-04-26 03:01:00 +00:00 committed by Sam Minnee
parent c8163eb609
commit ac2d9b35c0

View File

@ -191,7 +191,8 @@ TreeDropdownField.prototype = {
var ajaxURL = this.buildURL('tree?forceValues=' + this.inputTag.value); var ajaxURL = this.buildURL('tree?forceValues=' + this.inputTag.value);
var secId = jQuery(':input[name=SecurityID]'); var secId = jQuery(':input[name=SecurityID]');
ajaxURL += secId.length ? '&SecurityID=' + secId.val() : ''; 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.inputTag.value) ajaxURL += '&forceValue=' + this.inputTag.value;
if(this.search() != null) ajaxURL += "&search=" + this.search(); if(this.search() != null) ajaxURL += "&search=" + this.search();
new Ajax.Request(ajaxURL, { new Ajax.Request(ajaxURL, {