Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Content not loading into an editor

    Scenario:

    I am receiving variables, temp1,temp2 etc from a different page, say Page1, and grabbing it on Page 2. The Page 2 has the following code and its main goal is to grab a HTML template and insert it into an editor.


    Code:
    <script>
    $.extend({
        getUrlVars: function(){
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for(var i = 0; i < hashes.length; i++){
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
    })
    var button = $.getUrlVars()['button'];
    
    $("#temp1").click(function() {
        $("#sTinyMceEditorId").load("Folder/firsttemplate.html");
    });
    </script>
    
    <script>
    $("#temp2").click(function() {
        $("#sTinyMceEditorId").load("Folder/secondtemplate.html");
    });
    </script>
    
    <script>
    $("#temp3").click(function() {
        $("#sTinyMceEditorId").load("Folder/thirdtemplate.html");
    });
    </script>
    Here is how I have defined my editor:

    My editor is defined like the following on Page 2.

    Code:
    <div class="field">
    
     <textarea id="sTextBody" name="sTextBody" style="width:948px; max-width:948px; height: 70%"></textarea>
    </div>

    Here are the relevant Page 1 contents which could help in understanding above code:

    Code:
    <div id="templatesWrap">
        <div class="template" data-templatelocation="templateone" data-templatename="Template ONE" data-templateid="" >
         <div class="templateContainer">
         <span>
          <a href="" title="Use Template">
        <img class="thumbnail" src="templatefiles/thumbnail_010.jpg" alt="templateone">
        </a>
        </span>
            <div class="templateName">Template ONE</div>
                    <p>
            <a href="URL_for_page2?button?=temp1" title="Use Template" class="button secondary" id="temp1">Use Template</a>
                    </p>
            </div>
        </div>
    
    
     <div class="template" data-templatelocation="templatetwo" data-templatename="Template TWO" data-templateid="" >
        <div class="templateContainer">
        <span>
         <a href="" title="Use Template">
        <img class="thumbnail" src="templatefiles/thumbnail_011.jpg" alt="templatetwo">
        </a>
        </span>
        <div class="templateName">Template TWO</div>
        <p>
        <a href="URL_for_page2?button?=temp2" title="Use Template" class="button secondary" id="temp2">Use Template</a>
        </p>
        </div>

    Could anyone please tell me what could be the problem? I am working on this issue for so many days but still it's not working.
    Please let me know if you need more clarifications.

    P.S: I have included the proper jQuery link while using above jQuery functions and I am using TinyMCE 4.0.8 version.

    Thanks

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    This forum is for posting useful JavaScript for others to copy - not for asking for help with problems.

    Perhaps a moderator might move your post to the correct forum.

    It would also help if you were to describe what the problem is rather than just saying that there is a problem.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,917
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    Moved to JS frameworks section (since it’s about jQuery).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •