Solved

How can I modify the IFRAME settings (width) in CRM 4.0

Posted on 2011-03-10
10
1,275 Views
Last Modified: 2012-10-25
Hi all,
I have a CRM form with an IFRAME. I put a code on a field (on change); if this field is 1 i display a site in the IFRAME; if this site is 2 i display an other site on intranet.

But I want that this site in IFRAME has a width of 70% or alternatively so that this site will be adapted in the IFRAME (with no bar under the page).
How can i do this?

I past the code; I see that never enter in the else and I obtain an error.

Many thanks
Mark
// Waits for the content window of the IFrame to be ready
  function FixStylingInFrameSource(iframeID) {
      // Check the content window's ready state
      if (document.getElementById(iframeID).contentWindow.document.readyState
!= "complete") {
          // Re-run this function in 10 ticks
          window.setTimeout(function() { FixStylingInFrameSource(iframeID) }, 10);
      }
      // Content window is ready
      else {
          // Change the background color
          document.getElementById(iframeID).contentWindow.document.body.style.backgroundColor = "#eef0f6";
          // Remove the left border
          document.getElementById(iframeID).contentWindow.document.body.all(0).style.borderLeftStyle = "none";
          // Remove padding
          document.getElementById(iframeID).contentWindow.document.body.all(0).all(0).all(0).all(0).style.padding = "0px";

          // Make the cell the full width of the IFRAME
         document.getElementById(iframeID).contentWindow.document.body.all(0).style.width = "102%"

          // Show the IFrame
          document.getElementById(iframeID).style.display = "block";
      }
  }


if(crmForm.all.new_site.DataValue == 1)
{
  crmForm.all.IFRAME_site.src = "http://www.google.it";
  FixStylingInFrameSource('IFRAME_site');
}
else
{
  crmForm.all.IFRAME_site.src = "http://www.google.it";
  FixStylingInFrameSource('IFRAME_site');

}

Open in new window

0
Comment
Question by:helpdeskscm
  • 5
  • 5
10 Comments
 

Author Comment

by:helpdeskscm
ID: 35109823
I explain the problem little better. I have an IFRAME on my CRM FORM.
The URL of that IFRAME is one site in the intranet. Normally in Intranet when I click to this site , this authenticate the user and open a new windows (in full screen).

So when i put the url of this site in the IFRAME this load the second page in the IFRAME (based on authenticated user) but this page expanded in full screen; so in the Iframe I can't see the CRM fields and no scroll navigation bar.

How can I resolve? Can I resize this second page in the IFRAME border?

Or what can I do to resolve this problem?

Many thanks
Mark
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 35126609
Hi Mark,

Check out the attached image. Click on the iframe and then properties to get to this dialog. You can control the size by providing number of rows and so on.


Regards,
Chinmay

iframe.png
0
 

Author Comment

by:helpdeskscm
ID: 35129856
yes i put 10 Number of rows but....the problem is that the web site opens in full screen mode (because it is an option of the site)!

I can't change this option in the web page...........and when the iframe loads hides the other fields on the form!!

what can i do?A resize of the iframe after the page has loaded?

any ideas?
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 35133637
If the other site is opening up in a new window then it is difficult. I thought it is somehow increasing the size of the IFRAME but as I understand from your reply it is opening up an entire new window... in that case, you might wanna call window.focus() on the CRM form after your intranet site is loaded.
0
 

Author Comment

by:helpdeskscm
ID: 35139072
I try with window.focus() but I see my IFRAME (out of borders) and under the IFRAME the mouse cursor is focused on the 1° field but.....my IFRAME covers all crm fields.

I past the code that I have in the onload event of my form. When the IFRAME has loaded what can I do? Can i resize it in the borders? Or other ideas?
Can i resize the width and the height? The IFRAME is so big that i can't see the left scroll bar and the scroll bar under tha page....How can i see it in my IFRAME?

Thank you very much!

var iFrame = crmForm.all.IFRAME_new;
iFrame.attachEvent( "onreadystatechange" , Ready);

function Ready()
{  
    alert("change_state");

if (iFrame.readyState == "complete") {
alert("state_complete");

document.getElementById('IFRAME_new').width= "10%";
document.all.crmNavBar.parentElement.style.display = "none";
document.all.tdAreas.colSpan = 2;
window.focus() ;

}

}
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 35161848
try setting the width to 100 or something and let's see also please upload a screenshot if possible.
0
 

Author Comment

by:helpdeskscm
ID: 35187582
I upload the screenshot. You can see the CRM Form. When it loads the IFRAME (in red) opens in full screen in the form and it covers the other fiels on the form (in green). I tried to change the width to any values but does not work.........




 crm form
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 35188423
alright... do we have control over the code of the iframe in red?
0
 

Author Comment

by:helpdeskscm
ID: 35189479
no....because is an application of a third part and I can not modify the code.....
I can only know when the IFRAME become ready....

var iFrame = crmForm.all.IFRAME_new;
iFrame.attachEvent( "onreadystatechange" , Ready);

function Ready()
{  
    alert("change_state");

if (iFrame.readyState == "complete") {
alert("state_complete");

document.getElementById('IFRAME_new').width= "10%";
document.all.crmNavBar.parentElement.style.display = "none";
document.all.tdAreas.colSpan = 2;
window.focus() ;

}

}

I suppose that i can resize the IFRAME width and height in the borders after the IFRAME is load.....

But I don't know how to do this.....

Any ideas?
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 500 total points
ID: 35232855
Sorry for the delay, I lost track of your question.

Try this link : http://www.wolfcreekconsulting.com/support/techlib/web/DynamicallyResizedIframesPart2.php

Regards,
Chinmay.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This is a walkthrough guide I wrote whilst upgrading my on-premise MS Dynamics CRM 3.0 deployment to 4.0. This covers the actual installation of the product to a working level for my system, I ran into a lot of issues that the steps below fixed so h…
On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now