0

I just upgraded to JSF 2.3 & Wildfly 14 (from 2.0 and 13) and primefaces 6.2.5.

I noticed a strange behavior when i use a command button. I have 2 forms and when a push the button of the first form, the input of the second form is validated and the error (in this case required errors) are displayed in a p:message :

<h:form id="form1" prependId="false">
    <p:commandButton id="save" value="Save" actionListener="#{myBean.save()}" update="@form">
        <f:actionListener binding="#{myBean.reloadResults()}" />
    </p:commandButton>
    <p:messages id="msgs" severity="error,warn" escape="false">
        <p:autoUpdate />
    </p:messages>
...     
</h:form>

<p:dialog >
    <h:form id="form2" >
        <p:messages severity="error,warn" escape="false">
            <p:autoUpdate />
        </p:messages>
        <div>
            <p:calendar id="myDate" value="#{myBean.myDate}" required="true" />
        </div>
        ...     
    </h:form>
</p:dialog>

I was expecting only the content of the first form to be processed and validated. This was the case with wildfly 13 and jsf 2.0.

Any idea?

jobe
  • 325
  • 2
  • 14
  • 25

2 Answers2

0

You have not specified attribute process in your command button. Default value of this is @all which will validate all Forms. Please use process="@form" to avoid validation and process of other form.

Updated code is as below:

<p:commandButton id="save" value="Save" actionListener="#{myBean.save()}" update="@form" process="@form">
        <f:actionListener binding="#{myBean.reloadResults()}" />
    </p:commandButton>
Avanish
  • 1
  • 1
0

I have to apologize for not posting the entire code but it would have been to big. I found out what the problem was. It's related to this bug:

https://github.com/primefaces/primefaces/issues/4122

I have a panelgrid of 4 columns but with 10 elements in it.

The whole ajax communication was then broken. Fix is coming in PF 6.3

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
jobe
  • 325
  • 2
  • 14
  • 25
  • You should never post 'whole code' but always create a [mcve]... That is in 99.9% pf the cases never big.,,, – Kukeltje Oct 31 '18 at 17:25