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

Default behavior of NumberTranslator treats zeros asymmetrically.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.0
    • 4.1.2
    • Framework
    • None

    Description

      The default behavior of the NumberTranslator uses omitZero = true. I think that special treatment of zero values should not be the default behavior of NumberTranslator so that default behavior is entirely predicatable.
      Also, omitZero=true creates undesirably asymmetric behavior for processing zeros when you investigate a parse/format/parse cycle.
      If I enter a zero into a TextField that uses the NumberTranslator it gets parsed as a 0, when that 0 value is formatted for display, it will be formatted as "" even though it was entered and submitted as zero. Upon resubmitting this value, without and changes, the "" will be parsed as a null. This means that the parsed value can change even though the text value was never altered. I think this is bad and should not be the default behavior of NumberTranslator. I suggest defaulting omitZero to false. Also, it would make more sense that if omitZero were true, then empty text values should be parsed as 0's. This would create symmetric behavior even when omitZero is true.

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            pferraro Paul Ferraro
            Votes:
            4 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: