You are viewing limited content. For full access, please sign in.

Question

Question

Javascript errors when embedding a form in an iframe

asked on February 17, 2016

I'm using the embed code example found here (obviously, swapping out the generic values for my site-specific details):

    <script type="text/javascript" src='FormsServerURL/Forms/js/forms-embed.js?v=9.2'></script>
    <script type="text/javascript">
        var title = document.getElementById('title').innerHTML;
        var lf = new LaserficheForms.Form(document.getElementById('myform'), {
            bpid: 'ID', host: 'FormsServerURL/Forms', params: 'Topic_Name=' + title,
            onloadCallback: function () {
                var s = lf.getFrmDocument().getElementsByName('action');
                if (s.length > 0) {
                    s[0].onclick = function () {
                        document.getElementById('myform').style.display = 'none';
                    };
                }
            }
        });
    </script>;

 

But when I load the page I get the following javascript errors 

  • IE 11
    Object doesn't support property or method 'getFrmDocument'
  • Chrome
    Uncaught TypeError: lf.getFrmDocument is not a function
  • Firefox
    TypeError: lf.getFrmDocument is not a function
     

These errors point to the var s = lf.getFrmDocument().getElementsByName('action');​ line.

What is the updated method name that allows for grabbing the action button in Laserfiche forms?

0 0

Answer

SELECTED ANSWER
replied on February 18, 2016

are you including this javascript file? 

FormsServerURL/Forms/js/forms-embed.js

in this JS file i can see function called getFrmDocument

2 0
replied on February 18, 2016

Yes. As mentioned, I've swapped out FormsServerURL for the actual server name on which Forms is running.

Do you use this example without javascript errors?

0 0
replied on February 18, 2016

Nevermind. I'm a liar. 

 

I had added .getFrm(); to the end of that sample code to experiment with adjusting the options. This certainly changed what var lf was and prevented grabbing the action button.

 

I further complicated the issue by using this in an iframe on a different server, so the Blocked a frame with origin ____ from accessing a cross-origin frame error got me too. But that's something completely different.

 

Thanks for the response. It nudged me in the right direction of actually reading what I wrote :) 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.