Uploaded image for project: 'Prestashop 1.6'
  1. Prestashop 1.6
  2. PSCSX-5077

Country ISO code in pattern of JQuery Post Code Validation not used -> form-error added

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 1.6.0.11
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All-users
    • Labels:
      None

      Description

      There are a few countries with a postcode format like LV-2345 (Latvia). In the backend, the validation format is C-NNNN. In the validation function, I do not find any reference to this C in the pattern. This is not replaced by LV. Validation by PHP works fine.

      -----------------

      "iso_code":"LV","call_prefix":"371","active":"1","contains_states":"0","need_identification_number":"0","need_zip_code":"1","zip_code_format":"C-NNNN"

      -----------------

      function() {
      if ($(this).hasClass('is_required') || $(this).val().length)

      { if ($(this).attr('name') == 'postcode' && typeof(countriesNeedZipCode[$('#id_country option:selected').val()]) != 'undefined') var result = window['validate_' + $(this).attr('data-validate')]($(this).val(), countriesNeedZipCode[$('#id_country option:selected').val()]); else var result = window['validate_' + $(this).attr('data-validate')]($(this).val()) if (result) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok'); }

      }

      ------------------

      function validate_isPostCode(s, pattern) {
      if (typeof(pattern) == 'undefined' || pattern.length == 0) pattern = '[a-z 0-9-]+';
      else {
      var replacements =

      { ' ': '( |)', '-': '(-|)', 'N': '[0-9]', 'L': '[a-zA-Z]' }

      ;
      for (var new_value in replacements) pattern = pattern.split(new_value).join(replacements[new_value]);
      }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Gregory Gregory
                Reporter:
                AldertB Aldert Berends
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: