• Resolved hielkio

    (@hielkio)


    I hope anyone has an idea here. I used Magic tags to output some form results on a single line and wanted a simple solution to copy that line to the clipboard. So I inserted a little script as shown below:

    <button onclick="myFunction()">Copy GCode</button>
    <script>
    function myFunction() {
      var copyText = document.getElementById("myOutput");
      copyText.select();
      document.execCommand("copy");
      alert("Copied the text: " + copyText.value);
    }
    </script>

    It works like a charm, but this action also triggers the form submission. Is there a way to bypass this? This form doesn’t need submission at all btw.

    Thanks in advance ??

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Contributor christiechirinos

    (@christiechirinos)

    Hi there,

    We generally can’t help you troubleshoot or provide specific directions for custom code modifications because we are an open-source product company focused on improving our core product according to our roadmap. There are too many variables in how our code can be manipulated outside of that. However, there are many resources available that can point you in the right direction:

    – If you’re adding CSS to your site, review our recommendations for where to put your code, recommended themes, tutorials, and other best practices. https://calderaforms.com/doc/adding-custom-style-caldera-forms/
    – On the documentation page for any of our hooks, there is a panel at the end with the header “Where Does This Code Go?” That gives you links to introductory articles about what WordPress hooks are, why you use them and how to use them.
    – Caldera Forming is our customer and developer forum. As a part of this community, you can collaborate with other Caldera Forms modifiers for help with custom code and design. https://www.facebook.com/groups/651862761663883
    – We have implementation partners that we love who modify Caldera Forms professionally and can execute a tough modification for you for a fee. Learn more at https://calderaforms.com/caldera-forms-services/
    – Visit our developer documentation for tutorials and troubleshooting help. https://calderaforms.com/category/developer-api/

Viewing 1 replies (of 1 total)
  • The topic ‘Simple copy to clipboard button triggers form submission’ is closed to new replies.