Accessing the value of a Richfaces calendar during validation.

Posted by JBristow on Stack Overflow See other posts from Stack Overflow or by JBristow
Published on 2009-09-09T18:44:59Z Indexed on 2010/05/14 7:14 UTC
Read the original article Hit count: 327

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about seam

Related posts about richfaces