I am working on creating a simple modx 3rd party component and I have the basics working. I am working on the CMPs and am trying to modify my popup update record window. The associated record that is being edited has an id relating to another database table. How do I go about loading up a dropdown in the popup with these related fields? (I have the ids, but I want to get the names for the dropdown box)
I’m pretty sure I’m calling that url incorrectly but was unsure of how to utilize the path variables from javascript. I am using Mootools for the ajax Request. I’m assuming this is what I’m doing wrong as I beleive I need modx authentication first. Is there a different method to get the data I’m after? or do I need to write a new php script that authenticates with modx in ’mgr’ context and then gets the data?
LinkClouds.window.CreateCloudLink = function(config) {
//self reference
var self = this;
self.config = config || {};
//get linkclouds
new Request({
url: '../core/components/linkclouds/processors/mgr/linkcloud/getlist.php',
method: 'post',
onSuccess: function(response) {
//TODO: create dropdown box of linkclouds from response and add to applyIf
//create create window
console.log(response);
Ext.applyIf(self.config,{
title: _('linkclouds.cloudlink_create')
,url: LinkClouds.config.connectorUrl
,baseParams: {
action: 'mgr/cloudlink/create'
}
,fields: [{
xtype: 'textfield'
,fieldLabel: _('linkclouds.cloudlinks_name')
,name: 'name'
,width: 300
},{
xtype: 'textarea'
,fieldLabel: _('linkclouds.cloudlinks_desc')
,name: 'desc'
,width: 300
},{
xtype: 'textfield'
,fieldLabel: _('linkclouds.cloudlinks_link')
,name: 'link'
,width: 300
}]
});
LinkClouds.window.CreateCloudLink.superclass.constructor.call(self,self.config);
}
}).send();
};
Ext.extend(LinkClouds.window.CreateCloudLink,MODx.Window);
Ext.reg('linkclouds-window-cloudlink-create',LinkClouds.window.CreateCloudLink);
This code is semi-working right now. I say that because it throws this error when you first click the create button:
o.events is undefined
(function(){var h=Ext.util,k=Ext.each,...lclick",this.onNodeDblClick,this)}});
ext-all.js (line 7)
Then following this clicking the create button again works properly and you can create new records with the popup without a problem. But the ’response’ to the onSuccess function is blank though, again I’m assuming because of how I’m trying to get the data by calling the getlist processor directly.
Could someone please point me in the proper direction?
Thanks in advance