Can't get MigX to work on Multi-context site

I have struggled with this for a while, and now, I’ve come back round, copied to a development site and gone through a range steps to clear this error. As far as I can see, if I can clear the error, or at least stop it returning, I will be able to get it to work.

I don’t know why, but it’s tripping up over the TypeAhead feature in the listbox input field. If I manually deleted the code from the cache file, it errors on the TypeAhead feature on the multi-istbox input fields.

I’ve deleted cache, re-installed latest version (2.8.4) of Modx, deleted the MigX tables from DB, deletede the extra and re-installed it. Nothing helps. Hopefully someone with better knowledge of Modx Migx can point me in the right direction!

Ext.onReady(function() {
    var fld = MODx.load({
    
        xtype: 'combo'
        ,transform: 'tvinp_219_1_2'
        ,id: 'tvinp_219_1_2'
        ,triggerAction: 'all'
        ,width: 400
        ,allowBlank: true
                        ,maxHeight: 300        <br />
<b>Warning</b>:  Undefined array key "typeAhead" in <b>/var/www/vhosts/domain/core/cache/mgr/smarty/c8034ae4ed28c6de0b2811658fd02428f2dcbace_0.file.listbox-single.tpl.php</b> on line <b>65</b><br />
<br />
<b>Warning</b>:  Undefined array key "typeAhead" in <b>/var/www/vhosts/domain/core/cache/mgr/smarty/c8034ae4ed28c6de0b2811658fd02428f2dcbace_0.file.listbox-single.tpl.php</b> on line <b>65</b><br />
            ,editable: false
            ,typeAhead: false
                        ,forceSelection: false        ,msgTarget: 'under'

    
        ,listeners: { 'select': { fn:MODx.fireResourceFormChange, scope:this}}
    });
    Ext.getCmp('modx-panel-resource').getForm().add(fld);
});

Do you use MIGX as a TV or MIGXdb in a CMP?

Where does the Ext.js code you posted come from?

Can you share more information. Maybe the MIGX configuration?

@halftrainedharry - I am looking to possibly do both, MIGX as TV and also create a CMP using MIGXdb, but for now I am simpy trying to “Add Item” on the main MIGX page (see below). The Ext.js comes from the browser console when I “Add Item” or try and Edit an item I’ve added.

I don’t think this has anything to do with a “Multi-context site”. Everything you do in the manager is in the mgr context, so the other contexts shouldn’t matter.


What PHP version are you using?
Do you have display_errors activated?

It seems to me that a PHP warning is output to the JS code, that shouldn’t be there.

Does the problem go away if you change display_errors or the error_reporting level?

php 7.4.33 (but I get the same on 8.0.26)
display_errors = Off
error_reporting = 0

ModX error logging = 0 (FATAL only)

It is the PHP Warning that is in the JS code, which is weird, and if I could get it to go away I’d be really happy, but even setting them to Off / lowest levels makes no difference :frowning:

Can you try adding this code

if (!isset($params['typeAhead']) && ($field['inputTVtype'] == 'listbox' || $field['inputTVtype'] == 'listbox-multiple')) {
    $params['typeAhead'] = 0;
};

here in the code

and test if that helps?

1 Like

I like your way of thinking, but it just throws the following errors:

**Notice** : Undefined index: inputTVtype in **/core/components/migx/model/migx/migx.class.php** on line **1982**

But does it at least solve the problem?

You could probably fix it by changing the code to this:

if (!isset($params['typeAhead']) && isset($field['inputTVtype']) && ($field['inputTVtype'] == 'listbox' || $field['inputTVtype'] == 'listbox-multiple')) {
    $params['typeAhead'] = 0;
};

It’s not an error. It’s just a notice.

1 Like

Yup that fixed it!

There are other errors on save to do with Output headers already sent and stuff, but for now I can live with it. Fingers crossed I don’t get similar issues when I create MIGX TVs and start saving data to it/trying to extract the data!

Thank for the help @halftrainedharry - wish I knew ModX half as well as you do!

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.