JBoss.orgCommunity Documentation

6.25.  < rich:graphValidator >

The <rich:ajaxGraph> component allows to register Hibernate Validators for multiple input components.

Table 6.49. rich : graphValidator attributes

Attribute NameDescription
bindingThe attribute takes a value-binding expression for a component property of a backing bean
idEvery component may have a unique id that is automatically created if omitted
profileprofile
summarysummary
valuevalue

Table 6.50. Component identification parameters

NameValue
component-typeorg.richfaces.graphValidator
component-classorg.richfaces.component.html.HtmlgraphValidator
component-familyorg.richfaces.graphValidator
renderer-typeorg.richfaces.graphValidatorRenderer
tag-classorg.richfaces.taglib.graphValidatorTag

To create the simplest variant on a page use the following syntax:

Example:


...
<h:outputText value="Name:" />
       <h:inputText value="#{userBean.name}" id="name" required="true">
              <f:validateLength minimum="3" maximum="12"/>
              <rich:graphValidator event="onblur"/>
       </h:inputText>
...

Example:

import org.richfaces.component.html.HtmlCalendar;   

...
HtmlgraphValidator mygraphValidator= new HtmlgraphValidator();
...

The <rich:graphValidator> component behaves basically the same way as the <rich:beanValidator> The deference between these two components is that in order to validate some input data with a <rich:beanValidator> component, it should be a nested element of an input component, whereas <rich:graphValidator> wraps multiple input components and validates the data received from them.

The following example demonstrate a pattern of how the <rich:graphValidator> can be used.


...
<rich:graphValidator>
       <h:panelGrid columns="3">
              <h:outputText value="Name:" />
              <h:inputText value="#{validationBean.name}" id="name">
                     <f:validateLength minimum="2" />
              </h:inputText>
              <rich:message for="name" />
              <h:outputText value="Email:" />
              <h:inputText value="#{validationBean.email}" id="email" />
              <rich:message for="email" />
       </h:panelGrid>
</rich:graphValidator>
...

The data validation can be also performed using Hibernate Validator, the same way as it is done with <rich:beanValidator> .

The components's architecture provides an option to bind the component to a managed bean, which is done with the <value> attribute. The attribute ensures that the entered data is valid after the model is updated by revalidating the bean properties.

Please look at the example below.


...
<rich:graphValidator value="#{dayStatistics}">
       <h:outputText value="#{pt.title}" />
              <rich:inputNumberSpinne minValue="0" maxValue="24" value="#{pt.time}" id="time">
       </rich:inputNumberSpinner>
       <rich:message for="time" />  
</rich:graphValidator>
...