Tapestry 5.4.1 is failing for regexp validations when they are related to
numeric fields.

Example of regexp applied to a numeric field validation:
[0-9]+(\.[0-9][0-9]?)?

This fails because in validation.js matches function uses input.match(re);
Well if the regexp is for numeric field parseNumber function in same file
returns a Number object which as not a match function defined.

I think this is crucial and is another of my struggles to migrate T5.3 to
T5.4

Here is a RequireJS module to workaround this problems, contributing a
match function to Number prototype.

(function() {
    define([], function() {
        Number.prototype.match = function(regexp) {
            var result = this.toString().match(regexp);

            for(i = 0; i < result.length; i++) {
                // convert to int otherwise
                // groups[0] === input will fail
                result[i] = parseInt(result[i]);
            }
            return result;
        }
    });
}).call(this);


Best regards,
Ricardo Veloso

Reply via email to