Ajax (1) Apex Class (12) Apex Trigger (2) Community (2) Home Page (1) HTML (4) Integration (3) JS (7) KB (1) Label (1) Licenses (1) Listing (1) Log (1) OOPs (5) Sharing (1) Static Resource (1) Test Class (3) URI (1) Visualforce (10)

Tuesday, 26 August 2014

Monday, 25 August 2014

Collapse PageBlockSection

Collapse PageBlockSection by default on page load:
    <apex:page>  <apex:pageBlock id="block1">      <apex:pageBlockSection id="section1" columns="2" collapsible="true" title="Title">          Example Area      </apex:pageBlockSection>      <script>          twistSection(document.getElementById('{!$Component.block1.section1}').getElementsByTagName('img')[0])      </script>    </apex:pageBlock>  </apex:page>  

Disable collapse ability:
    <apex:page>  <apex:pageBlock id="block1">      <apex:pageBlockSection id="section1" columns="2" collapsible="false" title="Title">          Example Area      </apex:pageBlockSection>  </apex:pageBlock>  </apex:page>  

Thursday, 21 August 2014

Resize Iframe

<script language="JavaScript">


function autoResize(id){
    var newheight;
    var newwidth;

    if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
        newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
    }

    document.getElementById(id).height= (newheight) + "px";
    document.getElementById(id).width= (newwidth) + "px";
}

</script>

<iframe src="https://thekrrish.weebly.com" width="100%" height="100%"  name="CHANGETHIS" id="CHANGETHIS" marginheight="0" frameborder="0" onLoad="autoResize('CHANGETHIS');"></iframe>

Wednesday, 20 August 2014

Hide iframe element with id

<script>  function myFunction()  {  //alert("Page is loaded");  var iframe = document.getElementById('myFrame');  var frameDoc = (iframe.contentDocument || iframe.contentWindow.document);   frameDoc.getElementById('j_id0:SiteTemplate:j_id16:j_id17:j_id25:j_id26:j_id259').style.display = 'none';   //frameDoc.getElementById('j_id0:SiteTemplate:j_id16:j_id17:j_id25:j_id26:j_id67').style.display = 'none';      //alert("Page is loadedagain ");  }  </script>

    
<body onload="myFunction()">            <iframe id="myFrame" src="http://fullsb-aurea.cs16.force.com/internal/articles/en_US/Article/{!pkbCon.theKad.urlName}?l=en_US&fs=Search&pn=1" width="800" height="1000" ></iframe>                     </body>