0

everyone. I have few composite components on my page and after validation failed each of them adds it's own validation message in the . I found needed ability in 17.4 of the http://docs.oracle.com/cd/E28271_01/web.1111/e28163/af_message.htm maybe somebody knows a way to make it with Primefaces?

Thanks in advance!(-:

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
  • You can use [***p:messages***](https://www.primefaces.org/showcase/ui/message/messages.xhtml) tag to show combined messages for all validation failed! – Parkash Kumar Jun 22 '17 at 07:19
  • 1
    Possible duplicate of [Link an error message to multiple UIComponent in JSF2](https://stackoverflow.com/questions/8616086/link-an-error-message-to-multiple-uicomponent-in-jsf2) – Jasper de Vries Jun 22 '17 at 07:20

1 Answers1

0

There are few solutions for this problem.

  1. That one which discribed in Link an error message to multiple UIComponent in JSF2 but it doesn't work for me, becouse I have six of the same composite components.

  2. Same idea with validation on the last component but with using of

    <h:inputHidden id=''datecheck" validator="#{bb.validateSomeThing}"value="needed"/>

    that should to be placed after all components.

  3. My solution is

    <h:panelGrid id="example"> <f:event type="postValidate" listener="#{testBean.inputValidation}"/> <p:column> <my:compositeComponent param1="#{x.a[0]}" param2="#{y]}" update="#{something}" readonly="#{not editAccess}"/> </p:column> <p:column> <my:compositeComponent param1="#{x.a[1]}" param2="#{y]}" update="#{something}" readonly="#{not editAccess}"/> </p:column> <p:column> <my:compositeComponent param1="#{x.a[2]}" param2="#{y]}" update="#{something}" readonly="#{not editAccess}"/> </p:column> ... </h:panelGrid>

For more information I recommend to read Core JavaServer Faces (3rd Edition)

7th chapter Validation Relationships Between Multiple Components and 8th chapter Multi-Component Validation could be useful.