Hi all,
Just came across a problem when setting up some rules in this Form Customization.
Here’s one of my settings:
Action: core - resource/create (51)
Field: class_key
Containing Panel: modx-page-settings
Rule: Field Visible
Value: 0
Constraint Class: modDocument (this really is optional but - I want to apply it just to modDocument class)
all that seems producing this code in the manager screen when I go to this url: http://[site-name]/manager/?a=51
<script type="text/javascript">Ext.onReady(function() {Ext.getCmp("modx-page-settings").hideField("class_key");});</script>
but there is a javascript error when loading the page - and the field is not hidden, here’s the error:
Ext.getCmp("modx-page-settings").hideField is not a function
<script type="text/javascript">Ext.onR....hideField("class_key");});</script>
manager?a=51 (line 66)
I’m not too familiar with Ext JS library - but I think this because the function is not defined inside the Ext object which makes the function call - and when I looked at modext js - I see that there are two (2) instances of hideField function defined inside MODx.Window & MODx.FormPanel (as an extension of Ext.Window & Ext.FormPanel repectively)
Ext.extend(MODx.Window, Ext.Window, {
...
hideField: function (B) {
if (!Ext.isArray(B)) {
B = B[B];
}
var C;
for (var A = 0; A < B.length; A++) {
C = this.getField(B[A]);
if (!C) {
return;
}
C.hide();
var D = C.getEl().up(".x-form-item");
if (D) {
D.setDisplayed(false);
}
}
},
...
}
I tried:
MODx.Window.getCmp("modx-page-settings").hideField("class_key");
and
MODx.FormPanel.getCmp("modx-page-settings").hideField("class_key");
but both failed - getCmp does not exist in those two objects. Is there any workaround for this ? or this is because MODx extension objects has not call it’s superclasses ? - I’m just guessing, here
I experience this problem under MODx Revolution 2.0.0-rc-2 rev6923 & MODx Revolution 2.0.0-pl rev7212
I really appreciate it, if there is anyone here could give me any suggestions/workaround. Thanks