Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1386
  • Last Modified:

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

0
helpdeskscm
Asked:
helpdeskscm
  • 5
  • 5
1 Solution
 
helpdeskscmAuthor Commented:
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
 
Chinmay PatelEnterprise ArchitectCommented:
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
 
helpdeskscmAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Chinmay PatelEnterprise ArchitectCommented:
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
 
helpdeskscmAuthor Commented:
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
 
Chinmay PatelEnterprise ArchitectCommented:
try setting the width to 100 or something and let's see also please upload a screenshot if possible.
0
 
helpdeskscmAuthor Commented:
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
 
Chinmay PatelEnterprise ArchitectCommented:
alright... do we have control over the code of the iframe in red?
0
 
helpdeskscmAuthor Commented:
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
 
Chinmay PatelEnterprise ArchitectCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now