Question

Primefaces 3.5.16, JBoss 7.2.0, PE 0.7.1, Mojara 2.1.26, WELD-000900 1.1.10 (Final) Web.xml has some configuration stuff, faces-config has languages bundles defined.

I have following dialog with some input fields and p:tabview:

<p:dialog>

  <h:form>
   <p:tabView binding="#{tabViewEL}"> 
    <p:messages autoUpdate="true"/> 
  <p:tab  title="tab1">

    <p:inputText value="#{bean.value1}" required="true" />
    <p:inputText value="#{bean.value2}" />
    <p:selectOneMenu value="#{bean.value3}">
       <f:selectItems value="#{bean.items1}"></f:selectItems>
    </p:selectOneMenu>
  </p:tab>
  <p:tab> ... </p:tab>
  </p:tabView>

  <p:commandButton value="ok" oncomplete="checkAndHide(xhr, status, args);" action="#{bean.action()}"/>
  </h:form>

</p:dialog>

If I click "ok" and I am using OmniFaces v. 1.5 or 1.6 it functions right. If I'm using 1.6.1 all required fields (and p:selectOneMenu without null-selected-Item) are marked red with errors "Value is required". How can I use 1.6.1 without validation errors ?

Edit : I've tried to create an example but I've discovered another curious behavior of application. With OmniFaces 1.6 it functions right, but with 1.6.1 the input fields are not filled with values.

 OmnitestBean.java
 import java.io.Serializable;

 import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.inject.Named;

 @Named
 @SessionScoped
 public class OmnitestBean implements Serializable{
private Integer value1 = 12;
private Integer value2 = 3;

public OmnitestBean (){
    System.out.println("Constru");
}

@PostConstruct
public void a(){
    value1 = 14;
    value2 = 30;
    System.out.println("in postconstruct");
}

public Integer getValue1() {
    return value1;
}

public void setValue1(Integer value1) {
    this.value1 = value1;
}

public Integer getValue2() {
    return value2;
}

public void setValue2(Integer value2) {
    this.value2 = value2;
}

public void action(){
    System.out.println("In action");
}

 }

omnifaces.xhtml:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"    xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"
xmlns:fn="http://java.sun.com/jsp/jstl/functions" 
xmlns:pe="http://primefaces.org/ui/extensions">
<h:head />
<body>
<h:form id="editPopForm">
    <p:messages id="messages2" autoUpdate="true"></p:messages>
    <p:inputText value="#{omnitestBean.value1}" required="true" />
    <p:inputText value="#{omnitestBean.value2}" />

    <p:commandButton process="@form" action="#{omnitestBean.action()}" value="OK"
         update="@form" id="editFormOkButt" />
</h:form>

Was it helpful?

Solution

As BalusC noted in his comment it has something to do with Integer converter. I had the following dummy integer converter, it was hidden somewhere in project.

@FacesConverter(value = "someDummyConverter")
public class SomeDummyConverter extends IntegerConverter {
public Object getAsObject(FacesContext context, UIComponent component,
        String value) {
    Integer intValue = (Integer) super.getAsObject(context, component, value);
    return intValue;
}

@Override
public String getAsString(FacesContext context, UIComponent component, Object o) {
    return null;
}

}

If I used OmniFaces 1.5 or 1.6 this converter was not called. With OmniFaces 1.6.1, 1.6.2, 1.6.3 the converter was called. If I deleted the converter, the problem was disappeared.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top