mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX Fixed scenarios where the page is readonly and the expected ParentType elements don't exist causing a JS error
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@76258 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4389affa5c
commit
b1b07c5325
@ -97,8 +97,14 @@ Behaviour.register({
|
|||||||
// ParentType / ParentID field combination
|
// ParentType / ParentID field combination
|
||||||
'#Form_EditForm_ParentType' : {
|
'#Form_EditForm_ParentType' : {
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
$('Form_EditForm_ParentType_root').onclick = this.rootClick.bind(this);
|
var parentTypeRootEl = $('Form_EditForm_ParentType_root');
|
||||||
$('Form_EditForm_ParentType_subpage').onclick = this.showHide;
|
var parentTypeSubpageEl = $('Form_EditForm_ParentType_subpage');
|
||||||
|
if(parentTypeRootEl) {
|
||||||
|
parentTypeRootEl.onclick = this.rootClick.bind(this);
|
||||||
|
}
|
||||||
|
if(parentTypeSubpageEl) {
|
||||||
|
parentTypeSubpageEl.onclick = this.showHide;
|
||||||
|
}
|
||||||
this.showHide();
|
this.showHide();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -108,7 +114,8 @@ Behaviour.register({
|
|||||||
},
|
},
|
||||||
|
|
||||||
showHide : function() {
|
showHide : function() {
|
||||||
if($('Form_EditForm_ParentType_root').checked) {
|
var parentTypeRootEl = $('Form_EditForm_ParentType_root');
|
||||||
|
if(parentTypeRootEl && parentTypeRootEl.checked) {
|
||||||
Element.hide('ParentID');
|
Element.hide('ParentID');
|
||||||
} else {
|
} else {
|
||||||
Element.show('ParentID');
|
Element.show('ParentID');
|
||||||
|
Loading…
Reference in New Issue
Block a user