We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39438
    • 15 Posts
    My problem is related another of my posts: https://forums.modx.com/thread/84728/need-help-with-chunk-placeholder-and-snippet#dis-post-467376.

    I want to insert a chunk with Javascript into the head-section of some of my documents. I created a TV with Input Type: Checkbox and Output Type: Text and the binding @CHUNK to a particular chunk that contains a test Javascript:

    <script type="text/javascript">alert("this is Javascript");</script>


    This of course is only for test purposes, in the end I'll have a js with a real purpose.

    The TV is assigned to an 'experimental' template which itself is assigned to an 'experimental' document. In the manager/resource tree under Template Variables appears this TV with the following code-spagetti:

    " ,value: "" } ] }); Ext.getCmp('tv7-0').on('check',MODx.fireResourceFormChange); Ext.get('tvdef7').dom.value = ""; Ext.getCmp('modx-panel-resource').getForm().add(fld); }); // ]]> 


    If I write into the chunk in question some plain text without the script stuff then it works fine (by using the same mechanism).

    Can anybody tell me what the code-spagetti means? What's going wrong here?

    I read somewhere that I need to bind a TV to a snippet when attempting to insert Javascript. I'm going to try that, but any answer/suggestion would be very helpful along the way.

    [ed. note: kdmeloper last edited this post 13 years, 4 months ago.]