Thanks very much Martino,

an fool fault!, but it did not know clearly so that was the method
getAcceptsNull(), seemed to me very similar to isRequired() and I supposed
that they had the same function.

In the end, i think in extend the class

org.apache.tapestry.form.validator.Required

and it work, but it´s clear now that the solution was but simple, thanks.



On 7/30/07, Martino Piccinato <[EMAIL PROTECTED]> wrote:
>
> you made getAcceptsNull as "false" so you'll never receive a null to
> validate...
>
> On 7/30/07, César Augusto Mateus <[EMAIL PROTECTED]> wrote:
> > Hi all,
> > I did a Validator with the purpose of not to allow that a user entered a
> > date before of today.
> > That validation work fine, but not yet i can to do that this validator
> is
> > obligatory, because when i enter a null value, the validator was not
> call.
> > My Validator code here, thanks
> >
> > package co.org.amv.rupm.tapestry.models;
> >
> > import java.util.Date;
> >
> > import org.apache.tapestry.IMarkupWriter;
> > import org.apache.tapestry.IRequestCycle;
> > import org.apache.tapestry.form.FormComponentContributorContext;
> > import org.apache.tapestry.form.IFormComponent;
> > import org.apache.tapestry.form.ValidationMessages;
> > import org.apache.tapestry.form.validator.BaseValidator;
> > import org.apache.tapestry.form.validator.Validator;
> > import org.apache.tapestry.valid.ValidationConstants;
> > import org.apache.tapestry.valid.ValidatorException;
> >
> > public class ValidatorFecAntesHoyRequired extends BaseValidator
> implements
> > Validator  {
> >
> >
> >     public void validate(
> >             IFormComponent field, ValidationMessages messages, Object
> > object)
> >     throws ValidatorException {
> >         Date fecha = (Date) object;
> > //   IF THE USER ENTER A NULL VALUE, NEVER PAINT THIS
> >         System.out.println("----"+fecha);
> > //  THEN NEVER THROW THIS EXCEPTION
> >         if( fecha == null ){
> >             throw new ValidatorException( field.getDisplayName() + ":
> Debe
> > ingresar un valor", null );
> >         }
> >         Date hoy = new Date();
> >         if( fecha.after( hoy ) ){
> >             throw new ValidatorException(
> >                     field.getDisplayName() + ": La fecha no puede ser
> > posterior a la fecha actual", null );
> >         }
> >     }
> >
> >     public boolean getAcceptsNull() {
> >         return false;
> >     }
> >
> >     public boolean isRequired() {
> >         return true;
> >     }
> >
> >     public void renderContribution(
> >             IMarkupWriter arg0, IRequestCycle cycle,
> >             FormComponentContributorContext context, IFormComponent
> field) {
> >     }
> >
> > }
> >
> > Thanks for your help, Which is my error???
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to