1

I am working on a PrimeFaces project at my work. I have a form in which I need to validate 2 interdependent components. Both have to be filled or both can be empty. Is there any way ican do it without a custom validator Java class like in the XHTML itself. As this validator will be specific to that form and will not be used anywhere in the project. So even if I am making a interdependent component I need to code it such that it validates a list of components which can be two, three etc

<h:form id="manageEmploymentForm">
    <h:form id="someForm">
      <p:panel id="somePanel">
        .
        .
        .
        .//Other components
        .
        .
        .
        <p:selectOneMenu id="someMenu">
          <f:selectItem itemLabel="" noSelectionOption="true" />
          <f:selectItems value="#{myBean.list}" var="item" itemLabel="#{item.label}" itemValue="#{item.value}" />
        </p:selectOneMenu>

       <p:calendar id="someDate"
                   value="#{myBean.someDate}">
        </p:calendar>
      </p:panel>          
    </h:form>

Here I am trying to validate the <p:selectOneMenu> and <p:calendar> which are interdependent.

Tiny
  • 27,221
  • 105
  • 339
  • 599

0 Answers0