2 Replies Latest reply on Nov 14, 2007 7:37 PM by Damon Chong

    Different AJAX behaviour in Firefox and IE

    Damon Chong Newbie

      Hi,

      I tried to use a pop-up window to add a new record into the database and at the same time refresh the parent window's drop down list (reflecting the added new record). However, although the refresh works in IE (correct sequence, add to database then refresh browser drop down list) but the same is not happening in Firefox. The sequence is reverse in Firefox (refresh drop down list then add to database). This is the code that insert new record and refreshes.


      <h:commandButton id="confirm" value="Confirm" action="#{addTypeCtrl.confirm}"
       onclick="updateDropDownList();"/>
      


      The javascript function for refreshing is below:

      function updateDropDownList(){
       try{
       window.opener.document.forms[0].elements[window.opener.document.forms[0].elements.length-2].onclick();
       } catch (e) {
       alert("An exception occurred in the script. Error name: " + e.name
       + ". Error message: " + e.message);
       }
       self.close();
      }
      


      I don't know if I am using the right approach or if there's a better way. Any advice appreciated. Thanks a plenty!