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

validateCreditCard javascript could ignore whitespace and hyphens

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.3.0 Release
    • None
    • JavaScript
    • None
    • all

    Description

      the validateCreditCard javascript routine flags an input field as an invalid credit card number if the input field contains any non-numeric characters or whitespaces. I currently modify the input field's value before validation to remove whitespaces and hyphens, like this:

      $('paymentForm:cardNumber').value = $('paymentForm:cardNumber').value.replace(/ /g,'');
      $('paymentForm:cardNumber').value = $('paymentForm:cardNumber').value.replace(/-/g,'');

      It would be simple enough to have the validateCreditCard function handle this, but rather than modifying the input field value, it would modify the variable it is validating on, so the user does not see any `change` in what they have entered

      Attachments

        Activity

          People

            Unassigned Unassigned
            devinesy Paul Devine
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: