Mathias,

This request has come up on the mailing list quite often.
Any chance of a validateLessThan and validateGreaterThan addition to
tomahawk to complement validateEquals?   Maybe using a Comparable
interface if it's defined?

 -Mike

On 10/19/05, Mathias Brökelmann <[EMAIL PROTECTED]> wrote:
> define a custom validator for the second date field (must be the second).
>
> <h:inputDate id="lowerDate" value="#{yourBackinBean.lowerDate}"/>
> <h:inputDate value="#{yourBackinBean.upperDate}"
> validator="#{yourBackingBean.validateDates}"/>
>
> public class YourBackingBean
> {
>   public void validateDates(FacesContext context, UIComponent
> component, Object value) throws ValidatorException
>   {
>     UIInput lowerComponent = (UIInput)component.findComponent("lowerDate");
>     if(lowerComponent.isValid())
>     {
>       Date lowerDate = lowerComponent.getValue();
>       Date upperDate = (Date)value;
>       // compare the two dates and throw a ValidatorException with
> message if they are not valid
>     }
>   }
> }
>
>
> 2005/10/19, Maxence Dewil <[EMAIL PROTECTED]>:
> >
> >
> >
> > Hello,
> >
> >
> >
> > My application has to validate a form where a date depends on another date
> > (the first one must be < the next one), but the JSF validation is
> > component-oriented. How can I handle that in an elegant way?
> >
> >
> >
> > A solution is described here but I don't understand how to achieve it :
> > http://weblogs.java.net/blog/johnreynolds/archive/2004/07/improve_jsf_by_1.html
> > (#Validation of Inter-Dependent Fields).
> >
> >
> >
> > Regards,
> >
> >
> >
> > Maxence Dewil
>
>
> --
> Mathias
>

Reply via email to