Note that there are some explanatory texts on larger screens.

plurals
  1. POPrimefaces TabView does not maintain selectOneMenu Values
    text
    copied!<p>Hi I have a primefaces tabView looks like this</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"&gt; &lt;h:head&gt;&lt;/h:head&gt; &lt;h:body&gt; &lt;p:messages /&gt; &lt;h:form id="form"&gt; &lt;p:tabView dynamic="true"&gt; &lt;p:tab title="Tab"&gt; &lt;p:inputText required="true" value="value"&gt;&lt;/p:inputText&gt; &lt;/p:tab&gt; &lt;p:tab title="Select"&gt; &lt;p:selectOneMenu value="#{dummyController.selectedValue}" id="select" required="true" requiredMessage="Select is required"&gt; &lt;f:selectItem itemValue="1" itemLabel="asd"&gt;&lt;/f:selectItem&gt; &lt;f:selectItem itemValue="2" itemLabel="qwe"&gt;&lt;/f:selectItem&gt; &lt;f:selectItem itemValue="3" itemLabel="zc"&gt;&lt;/f:selectItem&gt; &lt;/p:selectOneMenu&gt; &lt;p:message for="select" /&gt; &lt;/p:tab&gt; &lt;p:tab title="Tab"&gt; &lt;p:inputText required="true" value="value"&gt;&lt;/p:inputText&gt; &lt;/p:tab&gt; &lt;/p:tabView&gt; &lt;h:commandButton action="#{dummyController.submit}" /&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/ui:composition&gt; </code></pre> <p>and it's controller</p> <pre><code>import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @ManagedBean @ViewScoped public class DummyController implements Serializable { private static final long serialVersionUID = 1L; private int selectedValue; public void submit() { } public int getSelectedValue() { return selectedValue; } public void setSelectedValue(int selectedValue) { this.selectedValue = selectedValue; } } </code></pre> <p>it has a strange behaviour, follow the steps tp reproduce:</p> <ul> <li>open the Select tab</li> <li>open other tab</li> <li>press Submit twice</li> </ul> <p>the first press nothing happens as regular, the next press triggers required message for the select, though it always has a value</p> <p>Please tell if something is missing or if there are any solutions</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload