MSaudi
MSaudi

Reputation: 73

jsf - validation failed on non processed input using primefaces

i am using primefaces, when submitting form i get validation failed on non processed input :-

<h:form id="result">
<p:outputPanel>
<m:inputProperty property="#{prop}"></m:inputProperty>
</p:outputPanel>
<p:inputText value="#{helper.subFormName}" required="true" styleClass="noprocess"
requiredMessage="#{tags.requiredMessage}" />
<p:commandButton value="#{msg.register}" action="#{registerBean.register}"
process="@(form:not(.noprocess))"></p:commandButton>
</h:form>

form is not submitting because of empty required input with class noprocess

what is the problem with that ? is it the process expression ? or what ?

Upvotes: 0

Views: 480

Answers (1)

bhdrk
bhdrk

Reputation: 3495

add space between "form" and ":not" elements.

@(form :not(.noprocess)) 

I try that. it works fine. if you click to submit, only input2 and input3 will be validated.

<?xml version="1.0" encoding="UTF-8"?>
<!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:p="http://primefaces.org/ui">
<h:head>
    <title>Primefaces Selectors</title>
</h:head>
<h:body>
    <h:form>
        <p:messages autoUpdate="true" />
        <h:panelGrid columns="2">
            <p:outputLabel value="Input 1:" for="input1"/>
            <p:inputText id="input1" value="" required="true" styleClass="noprocess"/>

            <p:outputLabel value="Input 2:" for="input2"/>
            <p:inputText id="input2" value="" required="true"/>

            <p:outputLabel value="Input 3:" for="input3"/>
            <p:inputText id="input3" value="" required="true"/>
        </h:panelGrid>
        <p:commandButton value="Submit" process="@(form :not(.noprocess))" />
    </h:form>
</h:body>
</html>

Upvotes: 1

Related Questions