What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to protect text widget data from being copied using javascript code

    Asked by fincalosbalcones on May 03, 2014 at 08:34 PM

    Please let me know how I can protect or block the text data in the text widget and prevent others can copying and pasting it.

    protect style size font
  • Profile Image
    JotForm Support Manager

    Answered by Jeanette on May 04, 2014 at 12:34 AM

    Probably, disabling the right click/ select text in an HTML page where you would need to embed the form could be the solution.

    Try this code, place it before the </head> tag of your webpage. Add your form within the <body> tags

    <script type="text/javascript">
        //Disable select-text script (IE4+, NS6+)
        function disableselect(e) {
            return false
        }
     
        function reEnable() {
            return true
        }
        //if IE4+
        document.onselectstart = new Function("return false")
        //if NS6
        if (window.sidebar) {
            document.onmousedown = disableselect
            document.onclick = reEnable
        }
    </script>

  • Profile Image

    Answered by fincalosbalcones on May 04, 2014 at 01:10 AM

    Please let me know how to do it in my form in JotForm, not in my webpage.

  • Profile Image
    JotForm Support

    Answered by Welvin on May 04, 2014 at 04:44 AM

    Unfortunately, we do not allow or we strip out scripts that are added into our form using Text Field. We've made these changes a few months ago due to security concerns.

    As suggested, consider adding the codes into your website. You are using Wix and I think you can add the codes using the HTML Block.

    Thanks

  • Profile Image

    Answered by fincalosbalcones on May 04, 2014 at 07:23 PM

    OK. This is the embed iFrame code from my form with the code disabling right click before, but it not function.

    <script type="text/javascript">
        //Disable select-text script (IE4+, NS6+)
        function disableselect(e) {
            return false
        } 
         function reEnable() {
            return true
        }
        //if IE4+
        document.onselectstart = new Function("return false")
        //if NS6
        if (window.sidebar) {
            document.onmousedown = disableselect
            document.onclick = reEnable
        }


    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="http://form.jotformpro.com/form/41206842198961" frameborder="0" style="width:100%; height:5415px; border:none;" scrolling="no"></iframe>
    <script type="text/javascript">window.handleIFrameMessage = function(e) {var args = e.data.split(":");var iframe = document.getElementById("JotFormIFrame");if (!iframe)return;switch (args[0]) {case "scrollIntoView":iframe.scrollIntoView();break;case "setHeight":iframe.style.height = args[1] + "px";break;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}


    </script>



  • Profile Image
    JotForm Support

    Answered by jonathan on May 04, 2014 at 09:37 PM

    Hi,

    I searched about the no rigth-click code possibility on Wix websites, and I found that it is currently NOT supported by Wix. You can can read a discussion about it on Wix here

     

    BUT what you can do instead to achieved the NO Right-Click Copy command in your form is to use the form's source code embed.

    And then, add the javascript code provided by our manager previously.

    This script

    <script type="text/javascript"> 

        //Disable select-text script (IE4+, NS6+) 

        function disableselect(e) { 

            return false 

        } 

     

        function reEnable() { 

            return true 

        } 

        //if IE4+ 

        document.onselectstart = new Function("return false") 

        //if NS6 

        if (window.sidebar) { 

            document.onmousedown = disableselect 

            document.onclick = reEnable 

        } 

    </script>

     

    Here is a sample website you can test where I have embedded your form and I added the javascript code.

    Source-Code-Prevent-Right-Click-Using-javascript.html

    If you try it, you will not be able to select Text anc Copy them from the form.

    --

    Follow this steps to apply the same to your Wix website.

    1. Get the source code embed of your form. Use this guide

    2. Embed the form full code into a blank/empty web page.. example, in your website create a blank html page  http://fincalosbalcones.wix.com/blank_empty_page.html

    3. Add the suggested No Right-Click javascript code to the web page created in Step#2 . This code http://pastie.org/9140921

    If you check the source code of my test website you will see I had the same javascript code added at the bottom but within the html <body> tags

     

    4. Save the new web page i.e.  http://fincalosbalcones.wix.com/blank_empty_page.html

    5. Now, to embed the new web page that have your form to your Wix website -- use this iframe code

    <iframe allowtransparency="true" src="http://fincalosbalcones.wix.com/blank_empty_page.html" frameborder="0" style="width:100%; height:5415px; border:none;" scrolling="no"></iframe>

    Please take note of the src code -- it should be the URL of your created web page where you have embedded the form.

    Use this guide also to embed on Wix website -Adding-a-form-to-Wix-Site

    6. Save the Wix page and then test your form.

    If all done correct, the No Righ-Click copy should be disabled on the form.

    Hope this help. Please inform us if you find difficulty doing this so we can assist you more.

    Thanks!

     


  • Profile Image

    Answered by fincalosbalcones on May 05, 2014 at 11:36 AM

    Thanks, but please explain me the following:  Where within the blank page in wix I should add the form source code and the suggested No Right-Click javascript code. In a Wix HTML widget?  or there is another form to do this?  Sorry for my question but I am confused.

    Following your instructions I tryed with the Wix HTML widget with the code that containing the form source code and the suggested No Right-Click javascript code in the bottom, but it not work.  How I can send to you this source code?

  • Profile Image
    JotForm Support Manager

    Answered by Jeanette on May 05, 2014 at 01:31 PM

    Sorry if I was not clear, my first suggestion was to add the script in the source code of the form. The workaround  suggested by Jonathan,  should go in the Wix HTML widget.

    I have made tests before and it works. I am not sure if it depends on the Wix theme. You can use pastie to paste the code you are trying to embed.

  • Profile Image

    Answered by fincalosbalcones on May 05, 2014 at 01:46 PM

    Now I understand why it does not work, my website is FLASH, and the code only works with HTML5 Wix sites.

  • Profile Image
    JotForm Support

    Answered by EltonCris on May 05, 2014 at 03:03 PM

    @fincalosbalcones

    Thanks for the info.

    That really matters. Flash has its own right click context menu as far as I know which I believe can't be controlled on the provided code. You must consider using HTML5 version if you want to use the code provided by my colleague.

    Regards!