mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: reintroducing the forceValue url param, so the TreeDropdownField value can be set via JS (previously if the item was deep within the tree structure it would not be selected)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98083 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
eba7aa8fc0
commit
75b7021c25
@ -183,8 +183,10 @@ class TreeDropdownField extends FormField {
|
|||||||
|
|
||||||
$obj->markPartialTree();
|
$obj->markPartialTree();
|
||||||
|
|
||||||
if($forceValues = $this->value) {
|
// allow to pass values to be selected within the ajax request
|
||||||
if(($values = preg_split('/,\s*/', $forceValues)) && count($values)) foreach($values as $value) {
|
if( isset($_REQUEST['forceValue']) || $this->value ) {
|
||||||
|
$forceValue = ( isset($_REQUEST['forceValue']) ? $_REQUEST['forceValue'] : $this->value);
|
||||||
|
if(($values = preg_split('/,\s*/', $forceValue)) && count($values)) foreach($values as $value) {
|
||||||
$obj->markToExpose($this->objectForKey($value));
|
$obj->markToExpose($this->objectForKey($value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,9 +171,10 @@ TreeDropdownField.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
ajaxGetTree: function(after) {
|
ajaxGetTree: function(after) {
|
||||||
var ajaxURL = this.helperURLBase() + 'tree/';
|
var ajaxURL = this.helperURLBase() + 'tree?';
|
||||||
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '';
|
||||||
if($('Form_EditForm_Locale')) ajaxURL += "&locale=" + $('Form_EditForm_Locale').value;
|
if($('Form_EditForm_Locale')) ajaxURL += "&locale=" + $('Form_EditForm_Locale').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, {
|
||||||
method : 'get',
|
method : 'get',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user