validation of multiple field
i have tried following code it doesn't work
kindly suggest!
my xhtml code:
<td>
<p:selectOneMenu id="findings" binding="#{findcomponent}" value="#{admin.rbean.findings[loop.index]}">
<f:selectItem itemLabel="Select" itemValue="Select" />
<f:selectItem itemLabel="Yes" itemValue="Yes" />
<f:selectItem itemLabel="No" itemValue="No" />
<f:selectItem itemLabel="NA" itemValue="NA" />
<f:attribute name="confirm" value="#{observation}" />
</p:selectOneMenu>
<font color="red">
<p:message for="findings" />
</font>
</td>
<td>
<p:inputTextarea id="observation" value="#{admin.rbean.observation[loop.index]}" validator="#{admin.validateName}" cols="30" rows="5" >
<f:attribute name="findcomponent" value="#{findcomponent}" />
</p:inputTextarea>
<font color="red">
<p:message for="observation" />
</font>
</td>
public void validateName(FacesContext context,UIComponent toValidate,Object value) throws ValidatorException
{
String nameStr = (String) value;
UIInput emailComponent = (UIInput) toValidate.getAttributes().get("findcomponent");
String find = (String) emailComponent.getValue();
if(find.equals("No"))
{
FacesContext context1=FacesContext.getCurrentInstance();
FacesMessage message1 = new FacesMessage("Enter the Observation!");
throw new ValidatorException(message1);
}
}