Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF difficulty with EL expression
    primarykey
    data
    text
    <p>I am facing a problem while using the property "required" JSF 2 + Prime Faces 3.5.</p> <p>The code below works perfectly:</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;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"&gt; &lt;ui:decorate template="/templates/main_template.xhtml"&gt; &lt;ui:define name="centro"&gt; &lt;h:head&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;f:view&gt; &lt;h:form id="form"&gt; &lt;h3&gt;TITLE&lt;/h3&gt; &lt;h:panelGrid id="panel1" columns="3"&gt; &lt;h:outputLabel for="input1" value="Input1" /&gt; &lt;p:inputText id="input1" value="#{controller.myObject.input1}" label="input1" required="#{empty param['form:input3']}"/&gt; &lt;p:message for="input1" /&gt; &lt;h:outputLabel for="input2" value="Input2" /&gt; &lt;p:inputText id="input2" value="#{controller.myObject.input2}" label="input2" required="#{empty param['form:input3']}"/&gt; &lt;p:message for="input2" /&gt; &lt;h:outputLabel for="input3" value="Input3" /&gt; &lt;p:inputText id="input3" value="#{controller.myObject.input3}" label="input3" required="#{empty param['form:input1']}"/&gt; &lt;p:message for="input3" /&gt; &lt;/h:panelGrid&gt; &lt;p:commandButton id="btn" value="Save" update="form" actionListener="#{controller.save}" /&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/h:body&gt; &lt;/ui:define&gt; &lt;/ui:decorate&gt; &lt;/html&gt; </code></pre> <p>If I add to my code a TAB VIEW, required field validation does not work anymore, as follows:</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;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"&gt; &lt;ui:decorate template="/templates/main_template.xhtml"&gt; &lt;ui:define name="centro"&gt; &lt;h:head&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;f:view&gt; &lt;h:form id="form"&gt; &lt;h3&gt;#{msgs.clienteCadastroTitulo}&lt;/h3&gt; &lt;p:tabView id="tabView"&gt; &lt;p:tab id="tab1" title="TAB 1"&gt; &lt;h:panelGrid id="panel1" columns="3"&gt; &lt;h:outputLabel for="input1" value="Input1" /&gt; &lt;p:inputText id="input1" value="#{controller.myObject.input1}" label="input1" required="#{empty param['form:input3']}"/&gt; &lt;p:message for="input1" /&gt; &lt;h:outputLabel for="input2" value="Input2" /&gt; &lt;p:inputText id="input2" value="#{controller.myObject.input2}" label="input2" required="#{empty param['form:input3']}"/&gt; &lt;p:message for="input2" /&gt; &lt;h:outputLabel for="input3" value="Input3" /&gt; &lt;p:inputText id="input3" value="#{controller.myObject.input3}" label="input3" required="#{empty param['form:input1']}"/&gt; &lt;p:message for="input3" /&gt; &lt;/h:panelGrid&gt; &lt;/p:tab&gt; &lt;/p:tabView&gt; &lt;p:commandButton id="btn" value="Save" update="form" actionListener="#{controller.save}" /&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/h:body&gt; &lt;/ui:define&gt; &lt;/ui:decorate&gt; &lt;/html&gt; </code></pre> <p>I will not post here everything I've tried, but they can be sure that I've tried using various methods outlined by tutorials, questions from other users, etc..</p> <p>Still I could not understand where I am going wrong and what you would like to give me some tips so I can perform my validation correctly.</p> <p>Basically, my required property should be dynamic according to the fill or not the fields in my form.</p> <p>Thank you all in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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