iframe disappears

Forums Dynamic Forms for SharePoint iframe disappears

Tagged: 

This topic contains 6 replies, has 2 voices, and was last updated by  Alexander Bautz 1 month, 2 weeks ago.

  • Author
    Posts
  • #18175

    Ivan Wilson
    Participant

    In one tab I have a HTML field that has an iframe.
    I have a rule that posts to the iframe.

    This works fine on my display form, but in my edit form the iframe contents disappears if I switch to the tab that contains the iframe.

    Using the developer tools, I can see the correct iframe details are loaded by the rule that runs on load. However, once I click on the tab that contains the html field with the iframe, the head and body tags are cleared. No rules are run, so I don’t know what is causing the iframe contents to disappear

    Any suggestions on how to troubleshoot or fix this?

    • This topic was modified 2 months, 1 week ago by  Ivan Wilson.
  • #18206

    Ivan Wilson
    Participant

    My attempts at debugging this haven’t gotten me a lot further. Somewhere between clicking on the tab and the tab loading, the iFrame is getting lost.

    I added a function to call in the tab’s click event. Using the browser debugger I can tell that by the time that function is called, the iframe contents is lost. The call stack doesn’t reveal much and there are no warnings or errors in the console.

    The odd thing is that this works fine in the display form, just not in the edit form.

    I’ve tried loading different pages in the iframe, but that doesn’t affect it. I’ve attached a before and after image of the DOM to show what’s happening.

  • #18229

    Alexander Bautz
    Keymaster

    Sorry for the late reply. I haven’t actually tried using an iframe in a HTML section like this myself – what exactly are you using it for? – maybe there is another way to achieve the same result?

    Alexandre

  • #18233

    Ivan Wilson
    Participant

    I’m displaying a web page from a separate external website. I pass the details in the list item as part of a POST request and this loads a page of related information in the iFrame.

    It works great on the display form, but something strange seems to be happening on the edit form.

  • #18292

    Alexander Bautz
    Keymaster

    I’m sorry again for the delay. I’m not sure why the content is dropped in the iframe, but maybe your function for loading it fires more than one time? – maybe on click of the tab? Are you able to “reload” the content by calling the function again?

    Are you able to see the contents if the tab with the iframe is the first tab so it is initially visible?

    Alexander

  • #18314

    Ivan Wilson
    Participant

    It displays fine on load if it is the first tab, but moving to another tab and back again results in the contents getting cleared.

    I can reload by calling my function from the tab’s onclick event, but this results in a delay while the content is reloaded. The displayform tab doesn’t have this problem – I can switch between tabs and the contents remains.

    Ivan

  • #18367

    Alexander Bautz
    Keymaster

    I’m sorry, but I cannot find anything in my code that could clear the iframe. I have tested putting an iframe loading another page in a tab in NewForm and can navigate to another tab and back without it loosing its content.

    Could you try loading it into another “container” – like a div using jQuery.get()

    Alexander

You must be logged in to reply to this topic.