Link to home
Start Free TrialLog in
Avatar of helpdeskscm
helpdeskscm

asked on

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

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

Avatar of helpdeskscm
helpdeskscm

ASKER

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
Avatar of Chinmay Patel
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
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?
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.
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() ;

}

}
try setting the width to 100 or something and let's see also please upload a screenshot if possible.
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.........




 User generated image
alright... do we have control over the code of the iframe in red?
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?
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial