function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
zezuruzezuru 

Issue in executing apex code through IE 9

Hey guys,

I am like two weeks into visualforce development and am stuck. I have a page with a datatable. one of the columns is basically a link to another popup page which returns selected value from a list. Basically this replicates visualforce lookup for opportunities but with a filter on accountid and an added functionality to create new opportunity if none exists.

 

The problem: everything works well in firefox. The Save option does nothing in IE9. Clicking it like ten times return the error basically saying that all fields are null and so the insert fails. I have set the IE security/privacy configurations as suggested in the online help. I have also tried emulating IE8.

 

The page:

 

<apex:page controller="LookupPopupController" sidebar="false" showheader="false">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<script language="javascript">
   var btnGo = document.getElementById("{!$Component.form.block.section.btnGo}");
   window.onload = new function() 
   { 
      window.focus(); 
      var ele=document.getElementById('{!$Component.form.block.section.query}');
      if (ele)
      {
         ele.focus();
      }
   }
   
   function fillIn(name, id)
   {
      var winMain=window.opener;
      if (null==winMain)
      {
         winMain=window.parent.opener;
      }
      var ele=winMain.document.getElementById('{!$CurrentPage.parameters.namefield}');
      ele.value=name;
      ele=winMain.document.getElementById('{!$CurrentPage.parameters.idfield}');
      ele.value=id;
      CloseWindow();
   }

   function CloseWindow()
   {
      var winMain=window.opener;
      if (null==winMain)
      {
         winMain=window.parent.opener;
      }
      winMain.closeLookupPopup();
   }
</script>

  <apex:messages />
  <apex:form id="form" >  

     <div style="width 100%">
        <apex:pageBlock title="Lookup" id="block">

          <apex:pageBlockSection id="section">
              Filter by Opportunity Name<br/>
              <apex:inputText value="{!query}" id="query"/> 
              <apex:commandButton id="btnGo" value="Search" action="{!runQuery}"/>
          </apex:pageBlockSection>

          <apex:pageBlockSection columns="1">
              <apex:pageBlockTable value="{!Opportunitys}" var="opvar">
                <apex:column headerValue="Name">
                  <apex:outputLink value="#" onclick="fillIn('{!opvar.Name}', '{!opvar.id}')">{!opvar.Name}</apex:outputLink>       
                </apex:column>
                <apex:column headerValue="Quote" value="{!opvar.Quote_Number__c}"/>
                <apex:column headerValue="Amount" value="{!opvar.amount}"/>
                <apex:column headerValue="Probability" value="{!opvar.probability}"/>
              </apex:pageBlockTable>    
          </apex:pageBlockSection>
        </apex:pageBlock>

        <apex:commandlink value="Create New Opportunity..." action="{!toggleContent}" rerender="opportunitypanel"></apex:commandlink>     

        <apex:outputpanel id="opportunitypanel">
        <apex:actionStatus startText="requesting..." stopText="" id="myStatus" />
        <style type="text/css">  
                .toggleContent {display:{!if(showContent,"block","none")};}  
        </style> 
        <div class="toggleContent"> 
        <apex:pageBlock title="New Opportunity">
          <apex:pageBlockSection collapsible="true">
                <apex:inputField value="{!ops.Name}" required="false"/>
                <apex:outputField value="{!ops.AccountId}" />
                <apex:inputField value="{!ops.CloseDate}" required="false"/>
                <apex:inputField value="{!ops.ForecastcategoryName}" required="false"/>
                <apex:inputField value="{!ops.StageName}" required="false"/>
            </apex:pageBlockSection>
          <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}" oncomplete="fillIn('{!ops.Name}', '{!ops.Id}')" rerender="error"/>
          </apex:pageBlockButtons>
          </apex:pageBlock>
          </div>
          </apex:outputpanel>   
         </div>
         <div>
             <apex:commandbutton value="Close" onclick="CloseWindow();">  
             </apex:commandbutton> 
         </div>

   </apex:form>
</apex:page>

It is the  <apex:commandButton value="Save" action="{!save}" oncomplete="fillIn('{!ops.Name}', '{!ops.Id}')" rerender="error"/>  code that is unresponsive in IE9.

 

and here's the apex class:

public with sharing class LookupPopupController
{
    public String query {get; set;}
    public String AccId {get; set;}
    public List<Opportunity> Opportunitys {get; set;}
    public Opportunity ops {get; set;}    
    public Boolean showContent { get; set; }  

    public PageReference toggleContent() {  
        if(showContent){  
            showContent = false;  
        }  
        else{  
            showContent = true;  
        }  
        return null;  
    }  
    public PageReference runQuery()
    {
        String query1;
        if (query == null){
           Opportunitys=[select id, name, quote_number__c, amount, probability from Opportunity where AccountId = :AccId];
           }
        else{
           query1 = '%'+query+'%';
           Opportunitys=[select id, name, quote_number__c, amount, probability from Opportunity where AccountId = :AccId and name like :query1];
           }
        return null;
    }
    public LookupPopupController(){
        showContent = false;  
        AccId=System.currentPagereference().getParameters().get('AccId');
        runQuery();
        ops = new Opportunity();
        ops.AccountId = AccId;
    }
    public PageReference save(){
        insert ops;
        return null;
    }
}

 

Thanks in advance for any help..

geosowgeosow

Did you ever resolve this?  I'm having the same issue.  Chrome, Safari, Firefox, IE 8 and lower all work.  IE9 is not working.

 

My code is really advanced -> 

 

<apex:commandButton action="{!updateAddress}" value="Update" reRender="messages,billingPanel"/><br/>

 

And by "advanced", I'm being totally sarcastic.  We're ready to go live and IE strikes again!!

 

Thanks.

geosowgeosow

I figured this out right after I posted above.  At least this worked for me.  I basically had to set the header, sidebar, and standardStylesheets to false like this:

 

<apex:page title="Checkout Page" label="Checkout Page" controller="totallyCheckoutController" showHeader="false" sidebar="false" standardStylesheets="false" >

 

Then I had to add <html>, <head> and <body> tags to my page code.  The <body> has to be around the <apex:form> component.  Let me know if this works for you.  I already had the standardStylesheets set to false so I'm not sure if you can get by without that parameter.  

 

<apex:page title="Checkout Page" label="Checkout Page" controller="totallyCheckoutController" showHeader="false" sidebar="false" standardStylesheets="false" >
<html>

<head>
   ....some stuff...
</head>

<body>
   <apex:form >
      ...a bunch of stuff that wasn't working in IE9...
...when wrapped inside the <body> tag it works in IE9!!!... </apex:form> </body> </html> </apex:page>