3
votes

I am using JSF Mojarra 2.2.1 , Primefaces 4.0 Snapshot and IE 9. This problem happens in IE 9 and also a similar problem exists when I replace it with f:ajax unless I render using @all. When command button is rendered via ajax request, it fires a normal request in the following request. I created a simple code to illustrate the problem.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">
<h:head>

</h:head>
<h:body>

    <h:form id="testForm">
        <h1>Test of IE9 Ajax</h1>
        Text: <h:outputText value="#{testBean.count}" />
        <br />
        <p:commandButton oncomplete="alert('a')" update=":testForm"
            action="#{testBean.increment}" value="click me">
        </p:commandButton>

    </h:form>

</h:body>
</html>

And my bean is,

package test;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean
@ViewScoped
public class TestBean implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private int count = 0;

    public void increment()
    {
        count++;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

}

In the test, alert is given on only at odd numbers which is an other indicator of ajax call is not made smoothly.

Update:

I realized this is happening because IE9 ignores inputs' onclick="javascript" events when they are replaced jquery's replace all method.

Update 2:

This does not happen in my home computer IE 9 (same version), it happens only in office computer. I cannot see security settings, Do you know why this happens? Javascript works but does not function properly.

Any help is highly appreciated.

Thanks

2
sometimes, this problem is due to primefaces's jar,try another version of primefaces,may it will work,also check IE console to know the issue - Charaf JRA
Changing to 2 older primefaces vers did not work, the interesting thing is that it renders following script for button click event but it executes script in first click and does not execute in the second click. Script : onclick="PrimeFaces.ab({source:'testForm:j_idt7',update:'testForm',oncomplete:function(xhr,status,args){alert('a');}});return false;" - erdemoo
can you try without a colon i.e.,update="testForm" ? - berkay
It does not happen in firefox 22 and ie 10. Console says nothing, I think it is all about how IE 9 handles dynamic added input elements by JSF or Primefaces. - erdemoo
Thanks BalusC, I am going to use the last stable version. If you read my updates, the problem is about my work computer's IE settings (which I cant see all of them remote, I need to ask IT), it also does not work smooth when I drop off prime faces and use jsf ajax although javascript is enabled. - erdemoo

2 Answers

0
votes

Please try the following code inside the <h:head> tag:

<f:facet name="first">
    <meta http-equiv="X-UA-Compatible" content="edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</f:facet>

Let's me know if it help.

0
votes

Resetted the security settings of the browser (IE 11) resolved the issue in my case. Unfortunately, I don't know which setting is responsible for this.