Answered by:
IFRAME populate content

Question
-
Hi,
I would like to populate the content of an IFRAME (not the URL) with some HTML.
I can do this through a normal ASP.NET IFRAME using the following code where IFPreview is the name of my IFRAME.
IFPreview.document.open();
IFPreview.document.write(document.getElementById('hfHtml').value);
IFPreview.document.close();
Trying to do the same through a MS CRM form is not successfull 'object does not support this property/method'.
I don't want to forward the IFRAME to a particular url, I want to display HTML on a field on my form... through this IFRAME.
Thanks in advance,
Karlo
Karlo Swart - http://www.ver206.comThursday, October 22, 2009 2:35 PM
Answers
-
Karlo,
I do this with my Embedded Advanced Find function at http://crmentropy.blogspot.com/2009/04/microsoft-crm-embedding-advanced-find.html
The relevant code is thus:var iFrame = document.getElementById(iFrameId); var win = iFrame.contentWindow; var doc = iFrame.contentWindow.document; // Without a null src, switching tabs in the form reloads the src iFrame.src = null; // Preload the iFrame with some HTML that presents a Loading image var loadingHtml = "" + "<table height='100%' width='100%' style='cursor:wait'>" + " <tr>" + " <td valign='middle' align='center'>" + " <img alt='' src='/_imgs/AdvFind/progress.gif' />" + " <div /><i>Loading View...</i>" + " </td>" + " </tr>" + "</table>"; doc.open(); doc.write(loadingHtml); doc.close();
Where iFrameId is the name specified for the IFRAME in the CRM Form editor (e.g. "IFRAME_Something").
Dave Berry- Proposed as answer by DavidBerryMVP, Moderator Thursday, October 22, 2009 5:09 PM
- Marked as answer by Karlo Swart Thursday, October 22, 2009 5:12 PM
Thursday, October 22, 2009 4:39 PMModerator
All replies
-
Karlo,
I do this with my Embedded Advanced Find function at http://crmentropy.blogspot.com/2009/04/microsoft-crm-embedding-advanced-find.html
The relevant code is thus:var iFrame = document.getElementById(iFrameId); var win = iFrame.contentWindow; var doc = iFrame.contentWindow.document; // Without a null src, switching tabs in the form reloads the src iFrame.src = null; // Preload the iFrame with some HTML that presents a Loading image var loadingHtml = "" + "<table height='100%' width='100%' style='cursor:wait'>" + " <tr>" + " <td valign='middle' align='center'>" + " <img alt='' src='/_imgs/AdvFind/progress.gif' />" + " <div /><i>Loading View...</i>" + " </td>" + " </tr>" + "</table>"; doc.open(); doc.write(loadingHtml); doc.close();
Where iFrameId is the name specified for the IFRAME in the CRM Form editor (e.g. "IFRAME_Something").
Dave Berry- Proposed as answer by DavidBerryMVP, Moderator Thursday, October 22, 2009 5:09 PM
- Marked as answer by Karlo Swart Thursday, October 22, 2009 5:12 PM
Thursday, October 22, 2009 4:39 PMModerator -
You rock Dave, thanks.
Karlo Swart - http://www.ver206.comThursday, October 22, 2009 5:12 PM