We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8740
    • 36 Posts
    o I need to add fields to a form dynamically and have this script...
    http://davidcaylor.com/?q=node/116

    Well works fine if my text area wasn’t a javascript..
    <script type="text/javascript">
    <!--
    //var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf(’_samples’)) ;
    var oFCKeditor = new FCKeditor( ’FCKeditor1’ ) ;
    oFCKeditor.BasePath = ’fckeditor/’;
    oFCKeditor.Height = 300 ;
    oFCKeditor.Value = ’The monkey loves you!’ ;
    oFCKeditor.Create() ;
    //-->
    </script>


    Any ideas on this?

    Also I need a remove function and a move function (move the group of fields up and down changing their index in the array.)
      • 33372
      • 1,611 Posts
      Are you saying that FCKeditor is rewriting and destroying your JavaScript? If so, that’s easy to resolve by moving that part of your content to a chunk or snippet (or just turning off the Rich Text Editor for that document). All of the RTEs mangle scripts in one way or another, so it’s best not to combine the two.
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 8740
        • 36 Posts
        No - nothing like that..
        I want to be able to dynamically add more fckeditor boxes along with a text box. But I don’t know how to do it since FCKeditor is just a JS instead of a form element.
          • 33372
          • 1,611 Posts
          Oh. I see. Well I’m no expert in FCKeditor, but I believe that it’s just a JavaScripted textarea field, so I would think that you could just make a function out of your FCKeditor declaration that takes the name of the textarea that you’ve just added and adds RTE capabilities to it.
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 8740
            • 36 Posts
            so something like this:
            function newfck()
            {
            var oFCKeditor = new FCKeditor( ’box[]’ ) ;
            oFCKeditor.BasePath = ’fckeditor/’;
            oFCKeditor.Height = 300 ;
            oFCKeditor.Value = ’The monkey loves you!’ ;
            oFCKeditor.Create() ;
            }

            Then use the onClick to run it?


            That didn’t work......
              • 33372
              • 1,611 Posts
              I think you’d need to call each textarea by id specifically rather than using the array name like you have, or perhaps cycle throughthe array and assign each value to a var and then call the function for each iteration of the var.
                "Things are not what they appear to be; nor are they otherwise." - Buddha

                "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options