Accessing the value of a Richfaces calendar during validation.
- by JBristow
I am trying to validate a field based on another field's value.
<h:form id="item">
<s:validateAll/>
<h:selectBooleanCheckbox id="selected" value="#{bean.selected}" validator="selectedValidator"/>
<rich:calendar id="startDate" value="#{bean.startDate}"/>
</h:form>
However, inside my validator.
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
UIInput startComp = (UIInput) context.getViewRoot().findComponent("item:startDate");
if(value != null && value) {
// Check value of startComp and throw exception if null or empty.
}
}
The component startComp resolves, but has no value. Where is the value that appears in the text box of the richfaces calendar component?