locked
CRM 2013: Unable to select the content of a embedded html inside a entity form RRS feed

  • Question

  • In my entity form I have a very simple embedded htlm. I want to be able to select the content of this html so, that I can do copy\paste. I have taken 2 approaches but  - I can't seem to be able to select the content text.

    Approach 1:

    <html>
     <body>
      <script src="ClientGlobalContext.js.aspx" type="text/javascript" ></script>
      <script src="tsi_jquery2" type="text/javascript"></script>
      <script src="tsi_json2" type="text/javascript"></script>
      <script src="tsi_XrmServiceToolkit" type="text/javascript"></script>
      
      <script type="text/javascript">
       var x = "Want to select this line but cant";
       document.write(x);
      </script>
     </body>
    </html>  

    Approach 2:

    <html>
     <body>
      <script src="ClientGlobalContext.js.aspx" type="text/javascript" ></script>
      <script src="tsi_jquery2" type="text/javascript"></script>
      <script src="tsi_json2" type="text/javascript"></script>
      <script src="tsi_XrmServiceToolkit" type="text/javascript"></script>
      
      <p id="demo"></p>
      
      <script type="text/javascript">
       var x = "Want to select this line but cant";
       document.getElementById("demo").innerHTML = x;
      </script>
     </body>
    </html>  


    Hasibur Rahman

    Wednesday, June 24, 2015 10:45 PM

Answers

  • if you import this "ClientGlobalContext.js.aspx" , unable select the text in html.

    you can set  _UI_TEXT_SELECTABLE = "1" in JS to solve the problem.

    

    Thursday, September 10, 2015 5:03 AM

All replies

  • Hi

    I have tested your code and all is working as expected with a bit of a delay.

    The WebResource gets rendered last.

    Also double check that the Restrict Cross -frame scripting is deselected on the WebResource.

    Thursday, June 25, 2015 11:36 AM
  • Hi ,

    Could you kindly tell me how to achieve this ( Restrict Cross -frame scripting is deselected ) for my need?


    Hasibur Rahman

    Friday, June 26, 2015 5:03 AM
  • I think I have narrowed down the problem. I don't thing it's due document.write but due using java script header

    <html>
     <body> 
      <script src="tsi_XrmServiceToolkit" type="text/javascript"></script> 
      <script src="ClientGlobalContext.js.aspx" type="text/javascript" ></script>
      <script src="tsi_jquery2" type="text/javascript" ></script>
      <script src="tsi_json2" type="text/javascript"></script> 
            <script type="text/javascript">
                  I can not select this
     
             </script>

    </body>
    </html>

    Could someone kindly tell me why is that?


    Hasibur Rahman

    Monday, June 29, 2015 10:07 PM
  • if you import this "ClientGlobalContext.js.aspx" , unable select the text in html.

    you can set  _UI_TEXT_SELECTABLE = "1" in JS to solve the problem.

    

    Thursday, September 10, 2015 5:03 AM