Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#3759 closed defect (fixed)

Remove redundant code in dojox.validator/regexp

Reported by: Adam Peller Owned by: dante
Priority: high Milestone: 0.9
Component: Dojox Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Adam Peller)

Happily, Dojo 0.9 provides much of this functionality and in a more "globalized" way so we can ditch a lot of the old validate code entirely.

This code should be removed in favor of dojo.currency:

  • dojox.regexp.currency
  • dojox.validate.isGermanCurrency
  • dojox.validate.isJapaneseCurrency
  • dojox.validate.us.isCurrency
  • dojox.validate.ca.isCurrency
  • dojox.validate.isCurrency

and these in favor of dojo.date which can provide localized regexps

  • dojox.regexp.time

and these in favor of dojo.number, which also provides regexps on demand:

  • dojox.regexp.integer
  • dojox.regexp.realNumber
  • dojox.validate.isInteger
  • dojox.validate.isRealNumber

and you should probably get rid of dojox.validate.isInRange which also bypasses i18n code and just let the user use boolean operators. I guess if such an API is necessary for check, we should find a way to implement it with dojo.number. We should never require the user to specify decimal separators as arguments or other parameters which require cultural info we already handle. This should be locale driven, wherever possible. That leaves country-specific stuff like zip codes, phone numbers, state lists, which are a little bit less interchangeable anyhow.

Change History (7)

comment:1 Changed 12 years ago by Adam Peller

Description: modified (diff)

comment:2 Changed 12 years ago by Adam Peller

Description: modified (diff)

comment:3 Changed 12 years ago by dante

Status: newassigned

taking ticket, but seek advice on best implementation. should dojox.validate be dropped for a robust dojox.regexp set all together? so people can just phoneString.match(dojox.regexp.isUsPhoneNumber) rather than just var myBool = dojox.validate.isUsPhoneNumner(phoneString)?

comment:4 Changed 12 years ago by dante

(In [9669]) removing redundant code refs #3759 - still wondering about API, validate stuff mostly just wraps regexps, so should this be a more robust regexp maker instead?

comment:5 Changed 12 years ago by Adam Peller

yup, though whatever you do, you'll have to make it work with check, should you choose to support check... and that may not belong in dojox.regexp.

note that the dijit.form.ValidationTextbox? knows how to take a regexp (regExpGen)

comment:6 Changed 12 years ago by dante

Resolution: fixed
Status: assignedclosed

dojox.validate has been stripped of said code. again, direction uncertian, interested parties should discuss on dojox developer forums at dojotoolkit.org

comment:7 Changed 12 years ago by bill

(In [10425]) Remove unused paramter. Refs #3759.

Note: See TracTickets for help on using tickets.