We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13414
    • 8 Posts
    I’m using the latest modx, and I can’t find a way to stop tinymce of deleting every "onclick" and "onchange" events from my pages sad
    I searched for a solution in this forum and in google, looks like this happens a lot, but every fix I tried did’nt work undecided

    Any advice will be welcome!
      • 4018
      • 1,131 Posts
      Can you post some before and after code? Wouldn’t mind playing with it to see what’s going on. smiley
        Jeff Whitfield

        "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
        • 13414
        • 8 Posts
        Sure, just create a new page, and try this code:

        <select Name="Figs1" onChange="AbreJanela(this);">
        <option value=0>Selecionar</option>
        <option value="a/agartha/1_ag01.jpg.html">1</option>
        </select>

        Now save then edit it again. It will be now:

        <select Name="Figs1">
        <option value=0>Selecionar</option>
        <option value="a/agartha/1_ag01.jpg.html">1</option>
        </select>
          • 10573
          • 101 Posts
          Would hiding your js in a chunk help?
            • 32319
            • 129 Posts
            I am getting the same results of loosing the javascript code.

            I used the Edit HTML feature.

            It may not be ideal but a quick work around would be to turn off the Rich Text check box under Page Settings for pages where you have these javascript issues. Sorry this does not solve your problem directly.
              "Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
              -- Sydney Harris
              • 13414
              • 8 Posts
              Using a chunk is not a option because every javascript would need a new chunk, too messy sad
              Disabling rich text is a temp fix, but works for now, thanks!

              The weird is this problem (bug?) is a common issue in tinymce and there is not a easy fix.
                • 32319
                • 129 Posts
                I have stopped using TinyMCE for my pages unless it is a page where a novice must be able to edit the code; in which case I keep the HTML as simple as possible. I have had other issues with TinyMCE mucking up my code in subtle ways. As I see it, it has the same problems that WYSIWYG editors have always have; you loose control of your code and there always seems to be a catch.

                An extension to my suggestion about turning off the rich text could be creating a TV for your forms then doing the rest of your content in the TinyMCE box then plug the form HTML in by using the TV call. This will isolate your more technical javascript code from the TinyMCE editor. I suppose this option will only be effective if your forms are well grouped.
                  "Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
                  -- Sydney Harris
                • Probably that’s the best call (dropping Tiny on those types of pages). Alternately you could use progressive enhancement and a JS library to grab an ID and add the JS to that particular item. In your example above, it would be the select element. Regardless, Jeff will take a peek at this later and see if he can come up with a solution, I’m sure.
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • On a side note, is there a way to prevent TinyMCE from auto-completing some HTML?

                    I have a header chunk that contains a Table (gasp!) ..er, the beginning HTML of a table. (e.g. <table><tr><td>)

                    Then, in a footer chunk, it contains the end HTML of the table. (e.g. </td></tr></table>)

                    However, if I use TinyMCE to edit, it seems to auto-complete my table when I really don’t want it to...I thought I saw a config section for "cleaning up HTML" or something...am I on the right track?
                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                    • I think that’s probably not a good option for Tiny-editable content, pixelchutes.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me