tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TAP5-2158) Client-side validation of @Size is not working when only min or max is set
Date Fri, 01 Nov 2013 12:33:17 GMT

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

Hudson commented on TAP5-2158:
------------------------------

FAILURE: Integrated in tapestry-trunk-freestyle #1173 (See [https://builds.apache.org/job/tapestry-trunk-freestyle/1173/])
TAP5-2158: Client-side validation of @Size is not working when only min (thiagohp: rev a073dc01c55a8316c63096a89a7424066128b821)
* tapestry-beanvalidator/src/test/java/org/example/testapp/entities/TestEntity.java
* tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java


> Client-side validation of @Size is not working when only min or max is set
> --------------------------------------------------------------------------
>
>                 Key: TAP5-2158
>                 URL: https://issues.apache.org/jira/browse/TAP5-2158
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-beanvalidator
>    Affects Versions: 5.4
>            Reporter: Balázs Palcsó
>            Assignee: Thiago H. de Paula Figueiredo
>            Priority: Minor
>             Fix For: 5.4
>
>
> Exact version: 5.4-alpha-14
> Server side example:
> {code}
> @Size(min = 3)
> private String name;
> {code}
> On the client side the following function gets executed:
> {code}
> doRangeValidate = function(element, value, memo) {
>       var max, min;
>       min = rangeValue(element, "data-range-min", 0);
>       max = rangeValue(element, "data-range-max", Number.MAX_VALUE);
>       if (_.isString(value)) {
>         value = value.length;
>       }
>       if (!((min <= value && value <= max))) {
>         memo.error = (element.attribute("data-range-message")) || "RANGE ERROR";
>         return false;
>       }
>       return true;
>     };
> {code}
> In the above example max is evaluated to NaN and therefore the function returns false
causing validation error.
> Same applies when you only max is specified in @Size annotation and min is evaluated
to NaN.
> h3. Workaround 
> Specify both min and max.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message