Thiago, below is the complete code base

AppModule.class

@SuppressWarnings("rawtypes")
    public static void
contributeFieldValidatorSource(MappedConfiguration<String, Validator>
configuration, JavaScriptSupport js) {
        configuration.add("minDate", new MinDate(js));
    }

Validator MinDate.class

public class MinDate extends AbstractValidator<String, Date> {

    public MinDate(JavaScriptSupport javaScriptSupport) {
        super(String.class, Date.class, "min-date", javaScriptSupport);
        System.out.println("min-date");
    }

    @Override
    public void validate(Field field, String constraintValue,
MessageFormatter formatter, Date value)
            throws ValidationException
    {
        System.out.println("ConstraintValue " + constraintValue);
        //throw new ValidationException(buildMessage(formatter, field,
constraintValue));
    }

    private String buildMessage(MessageFormatter formatter, Field field,
String constraintValue) {
        return formatter.format(constraintValue, field.getLabel());
    }

    @Override
    public void render(Field field, String c, MessageFormatter mf,
MarkupWriter writer, FormSupport fs) {
//        throw new UnsupportedOperationException("Not supported yet.");
//To change body of generated methods, choose Tools | Templates.
    }

}

tml

<t:DateField t:id="vacationAnniversary"  t:format="MM/dd/yyyy"
value="timeSheetEntity.vacationAnniversary"/>

TimeSheetEntity.class

@NonVisual
@Validate("minDate=test")
@Temporal(TemporalType.DATE)
private Date vacationAnniversary;


On Tue, Dec 10, 2013 at 8:44 PM, George Christman
<gchrist...@cardaddy.com>wrote:

> Hi Thiago, I'm not at work atm to get you the app module code, but it's
> just the standard contribute validator method where I instantiate new
> MinDate() and pass in the javascript service through the constructor.
>
> Yes, the constructor is being called, I can see my output in the logs.
>
> I'm using the tapestry date picker component. When I submit the form I
> should see the fields current value regardless of the constraint value
> correct? When using date, the validate method does not get called and I do
> not get any exceptions in the browser.
>
> If I switch the data type to a String and put my validation annotation on
> a String property, my code works fine.
>
> This same issue can be seen while using the regex validator with the data
> picker component by disabling clientsideValidation.
>
> Yes I'm aware the js is completely separate from serverside valdiation.
> I'm trying to get the serverside piece up and running.
>
>
> On Tue, Dec 10, 2013 at 4:24 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> On Tue, 10 Dec 2013 17:23:43 -0200, George Christman <
>> gchrist...@cardaddy.com> wrote:
>>
>>  I annotated my entity property like so for testing. I realize "test" is
>>> not a valid date, but should still make the output in validate.
>>>
>>
>> How do you expect your validation to work with an year that doesn't exist?
>>
>>
>>
>>> @NonVisual
>>> @Validate("min-date=test")
>>>     @Temporal(TemporalType.DATE)
>>>     private Date vacationAnniversary;
>>>
>>> Calender component is being used.
>>>
>>
>> Still code missing. Where's the contribution in AppModule?
>>
>> Can you see any exceptions in the console? Is your validator constructor
>> actually called?
>>
>>
>>  I was referring to the validators js. You can test this very easily with
>>> the regexp validator. Simply add the validator to a date field and submit
>>> it with a bad value. You'll get a clientside validation error. If you
>>> were to disable clientside validation and attemp to submit the form, your
>>> submission will not be intercepted by serverside validation.
>>>
>>
>> Server-side validation is performed with and without client-side
>> validation.
>>
>> I thought you were originally referring to JavaScript validation you had
>> implemented in your validator, causing me to not understand what you were
>> talking about, as the client validation of one validator is completely
>> unrelated to the server-side validation from another validator.
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Reply via email to