Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1170

Problem with dojo.validate.isInRange(), desired flexibility in Tapestry validators

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.1.1
    • 4.1.1
    • Framework, JavaScript
    • None

    Description

      The bug is really in dojo.validate.isInRange(), but it can be worked around with a change in the validator call.

      I have a custom validator that allows numeric values with comma separators. It uses dojo.validate.isInteger() with the separator parameter.

      This should work with dojo.validate.isInRange(), but it has a bug:

      value = value.replace(dojo.lang.has(flags,'separator')?flags.separator:',', '', 'g').
      replace(dojo.lang.has(flags,'symbol')?flags.symbol:'$', '');

      the default if flags does not have the separator property (which it won't from Min and Max) should be

      /,/g

      instead of ','. String.replace() doesn't take 3 parameters in IE 6, it takes 2, and the first one is a regular expression.

      I can redefine this function for now, but I'd like to see the Tapestry validators allow for configuration of separators too.

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            gwoolsey Greg Woolsey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: