tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Kemnade (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2258) AbstractValidator does not work with Date type
Date Sat, 17 May 2014 15:37:14 GMT

    [ https://issues.apache.org/jira/browse/TAP5-2258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14000806#comment-14000806
] 

Jochen Kemnade commented on TAP5-2258:
--------------------------------------

I just tried to reproduce the issue with 5.4-beta-6. I get a "ConstraintValue test" in the
logs if I submit the form with a valid date. Can you please check if this is still an issue
for you?

> AbstractValidator does not work with Date type
> ----------------------------------------------
>
>                 Key: TAP5-2258
>                 URL: https://issues.apache.org/jira/browse/TAP5-2258
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.4
>            Reporter: George Christman
>
> While trying to create a minimum date I noticed the AbstractValidator does not call the
validate method when the datatype Date is used. See discussion on mailing list
> http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Custom-Validator-for-Date-field-not-working-td5725189.html
> Sample test code
> 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; 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message