We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23018
    • 353 Posts
    Based on using tags in TV descriptions (see: https://forums.modx.com/thread/89400/why-is-modx-stripping-tags-from-tv-descriptions), I have now added collapsible description texts and the ability to open links inside the description as a modal window.

    Everything BUT the modal window is working fine so far.

    I'm using this to open the modal window:

                           /* url grabbed from link */
                            var url = 'http://example.com/example.html';
                            var win = new Ext.Window({
                                  id: 'window{$tv->id}'
                                , title : "{$lang_help}: {if $tv->caption}{$tv->caption}{else}{$tv->name}{/if}"
                                , width : 500
                                , height: 400
                                , layout: "fit"
                                , autoLoad: {
                                    url : url
                                    , scripts : false
                                }
                                 
                            });
                            win.show();
    


    But I get an error:

    Unexpected token <:
    405 Not Allowed
    nginx/1.4.4

    My test environment is running MODX2.2.12 on modxcloud.

    Any idea? Whats going wrong?

    Regards,

    pepebe

    This question has been answered by pepebe. See the first response.

    [ed. note: pepebe last edited this post 12 years, 7 months ago.]
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • 23018
      • 353 Posts
      Got rid of that problem by changing some of the js:

                     
                              var url = 'http://example.com/example.html';
                              MODx.helpWindow = new Ext.Window({
                                    id: 'window{$tv->id}'
                                  , title : "{$lang_help}: {if $tv->caption}{$tv->caption}{else}{$tv->name}{/if}"
                                  , width: 850
                                  , height: 500
                                  , modal: true
                                  , layout: "fit"
                                  , html: '<iframe onload="parent.MODx.helpWindow.getEl().unmask();" src="' + url + '" width="100%" height="100%" frameborder="0"></iframe>'
                              });
                              
                              MODx.helpWindow.show(Ext.getBody());  


      This opens a new modal including the content of example.html.

      Unfortunately height and width are much small than the values given. I'm clueless...
        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • discuss.answer
        • 23018
        • 353 Posts
        Got it again. Turns out using

        id: 'window{$tv->id}'


        was a bad idea. Changing it into

        id: 'win{$tv->id}'


        Made it perfect.

        Regards,

        pepebe
          Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe