You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Szemere Szemere <sz...@gmail.com> on 2013/04/26 15:54:11 UTC

Old Tapestry Validation JavaScript in 5.3.6

We have two web apps, both on Tapestry 5.3.6. One (app A) came through
prior Tapestry versions from ~5.0.x maven archetype. The other (app B)
started with 5.3.6.

The problem is number validation doesn't work in App A. It appears to be
because the numerifformat definition in the validation.js file is different
in the two apps.

In AppA, we see:
/** Supplies a client-side numeric translator for the field. */
   numericformat : function(field, message, isInteger) {
    $(field).tapestryFieldEventManager({translator : function(input) {
     if (!(!isNaN( parseFloat(input) ) && isFinite( input )))
      $(field).tapestryFieldEventManager("showValidationMessage",message);
     else return parseFloat(input);
     /*
      * maybe the formatLocalizedNumber method should be implemented here,
to really fit tapestry's way
      * but we assume that parsing to float is ok atm
      */
    }
    });

In AppB, we see:
/** Supplies a client-side numeric translator for the field. */
    numericformat: function (field, message, isInteger) {
        $(field).getFieldEventManager().translator = function (input) {
            try {
                return Tapestry.formatLocalizedNumber(input, isInteger);
            } catch (e) {
                $(field).showValidationMessage(message);
            }
        };
    },

I can't figure out why AppA wouldn't have the latest Tapestry javascript
library for validation.
One difference between the apps is that AppA includes tapestry-jquery and
tapestry-bootstrap. Could that cause the difference, or there some other
likely suspects to investigate?

Szemere

Re: Old Tapestry Validation JavaScript in 5.3.6

Posted by Szemere Szemere <sz...@gmail.com>.
The offender is **tapestry-bootstrap** as it rolls it's own version of
validation.js which is out-of-date (compared to 5.3.6). We've patched it
(will try to get that into tapestry-bootstrap lib) and it works.

Szemere