Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-225

locale aware validator scripts required

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.3.1 Release
    • None
    • JavaScript
    • None
    • shale1.0.4, JSF1.1

    Description

      when the locale is EN: thousand seperator="," , decimal seperator='.' (like: 123,45.67)
      when the locale is TR(my case): thousand seperator="." , decimal seperator=',' (like: 123.45,67)

      as far as i can see, validator javascripts written for EN locale in mind.. so, validator scripts are not working properly for my situation...

      for example, for the above value, validateFloat will split my number after 123.. i didn't control all but some other validators may fail in such a situation too..

      A solution that we can apply to commons-validator might be like this;
      ValidatorScript component reaches necessary localized symbols and puts them into a localeSpecificSymbols[] array... resulting javascipt code will be like this:

      ------------------------------------------------------------------
      var GROUPING_SEPARATOR_INDEX = 0;
      var DECIMAL_SEPARATOR_INDEX = 1;

      var localeSpecificSymbols =

      {'.', ',', .....}

      ;
      ------------------------------------------------------------------

      by this way, any validator which needs one of these symbols can reach this symbols array and use it as necessary....

      example validateFloat implementation code will then be like:
      var tempArray = value.split(localeSpecificSymbols[DECIMAL_SEPARATOR_INDEX]);
      instead of
      var tempArray = value.split('.');

      i have injected this solution into my local commons-validator and shale jars and it's succeeded ...

      PS : sorry for the incorrect code parts.. i can not reach my original code for now.. written them only for visualize the problem and solution.. however, i can send the correct code later, if required..

      regards..

      hasan..

      Attachments

        Activity

          People

            Unassigned Unassigned
            hasant Hasan Turksoy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: