title: Interdependent components validation
body: <p>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</p>
  
  <pre><code>&lt;h:form id="manageEmploymentForm"&gt;
      &lt;h:form id="someForm"&gt;
        &lt;p:panel id="somePanel"&gt;
          .
          .
          .
          .//Other components
          .
          .
          .
          &lt;p:selectOneMenu id="someMenu"&gt;
            &lt;f:selectItem itemLabel="" noSelectionOption="true" /&gt;
            &lt;f:selectItems value="#{myBean.list}" var="item" itemLabel="#{item.label}" itemValue="#{item.value}" /&gt;
          &lt;/p:selectOneMenu&gt;
  
         &lt;p:calendar id="someDate"
                     value="#{myBean.someDate}"&gt;
          &lt;/p:calendar&gt;
        &lt;/p:panel&gt;          
      &lt;/h:form&gt;
  </code></pre>
  
  <p>Here I am trying to validate the <code>&lt;p:selectOneMenu&gt;</code> and <code>&lt;p:calendar&gt;</code> which are interdependent.</p>