MODX Community

Add Listener via ExtJS Override

Is it possible, given the way the manager is structured, to add a listener to a field by way of extending or overriding the appropriate modx class? I’m having trouble identifying where (in which extjs class) the resource form is ultimately being built. Specifically, I’m looking to add a change listener to a specific tv text field, which would initiate some pre processing via ajax (this processing part I can handle). Can anyone point me in the right direction on this one?

You can create a Custom Template Variables and use the render template for “textbox” template variable as example.

Thanks for chiming in! While there may be different avenues (such as the one you suggest) to achieve the functionality I’m looking for, I’m mainly looking to get a better handle on modx’s implementation of ExtJS and how I can manipulate what I want to with ExtJS principles in mind. In theory, I should be able to create an override to alter a specific field’s config before or as the form component is being built or laid out. If I’m right on that assumption, the question is whether it’s at all practical.

The component used to build the resource form: https://github.com/modxcms/revolution/blob/708ed11edda3864ec1949b263f7654a27a1117cf/manager/assets/modext/widgets/resource/modx.panel.resource.js

This is how the input field for the template variable is added to the resource form: https://github.com/modxcms/revolution/blob/708ed11edda3864ec1949b263f7654a27a1117cf/manager/templates/default/element/tv/renders/input/textbox.tpl#L27