Jon Bristow
Jon Bristow

Reputation: 1725

Accessing the value of a Richfaces calendar during validation

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?

Upvotes: 1

Views: 2578

Answers (2)

Ken
Ken

Reputation: 36

try this: item:startDatInputDate

Upvotes: 2

Umesh Aawte
Umesh Aawte

Reputation: 4690

Please check value of startDate in your bean that is you used in the tag here.

Upvotes: 0

Related Questions