Return-Path: X-Original-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AD8AE9BC7 for ; Fri, 2 Mar 2012 14:27:40 +0000 (UTC) Received: (qmail 5884 invoked by uid 500); 2 Mar 2012 14:27:40 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 5852 invoked by uid 500); 2 Mar 2012 14:27:40 -0000 Mailing-List: contact flex-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-dev@incubator.apache.org Received: (qmail 5842 invoked by uid 99); 2 Mar 2012 14:27:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 14:27:40 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.214.47] (HELO mail-bk0-f47.google.com) (209.85.214.47) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Mar 2012 14:27:31 +0000 Received: by bkcjg15 with SMTP id jg15so1603808bkc.6 for ; Fri, 02 Mar 2012 06:27:11 -0800 (PST) Received-SPF: pass (google.com: domain of nicholas@spoon.as designates 10.205.133.13 as permitted sender) client-ip=10.205.133.13; Authentication-Results: mr.google.com; spf=pass (google.com: domain of nicholas@spoon.as designates 10.205.133.13 as permitted sender) smtp.mail=nicholas@spoon.as Received: from mr.google.com ([10.205.133.13]) by 10.205.133.13 with SMTP id hw13mr5138230bkc.25.1330698431603 (num_hops = 1); Fri, 02 Mar 2012 06:27:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.205.133.13 with SMTP id hw13mr4121207bkc.25.1330698431331; Fri, 02 Mar 2012 06:27:11 -0800 (PST) Received: by 10.205.47.67 with HTTP; Fri, 2 Mar 2012 06:27:11 -0800 (PST) X-Originating-IP: [35.8.29.149] In-Reply-To: References: Date: Fri, 2 Mar 2012 09:27:11 -0500 Message-ID: Subject: Re: mx PostCode validator class From: Nicholas Kwiatkowski To: flex-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=000e0ce0d6724d7e9c04ba435f8a X-Gm-Message-State: ALoCoQmpKPBURhPa7mNsHiETuGM47SblZDM8hvf9HRvhKHSal8bFbV8JvgCiQwZEcaj+DeDsw9mx X-Virus-Checked: Checked by ClamAV on apache.org --000e0ce0d6724d7e9c04ba435f8a Content-Type: text/plain; charset=ISO-8859-1 What are your thoughts about adding this functionality to the ZipCodeValidator instead of having it as a separate component? I have to check against multiple countries, and it seems silly to have to load two different components that do basically the same thing (except for locale). Another option would be to add the US Zip validation ruleset into your component and leave the ZipCodeValidator alone. -Nick On Wed, Feb 29, 2012 at 10:09 PM, Justin Mclean wrote: > Hi there, > > I've created a first pass at an mx style post code validator. It still > needs some work. It can be found in my white board area here: > http://svn.apache.org/viewvc/incubator/flex/whiteboard/jmclean/validators/ > > It supports either a single postcode format or an array of postcode > formats. Formats are defined as strings consisting of N,A,CC,- or space > where is N is a number, A is a letter, CC is country code (optional) and > "-" or space for formatting. eg "NNNN" is a 4 digit postcode. "NNNN AA" is > 4 digits, followed by a space followed by 2 letters. > > It doesn't validate for ranges of numbers or exact letters. I've > considered a way of setting a call back that calls a user defined function > to do this. > > Would anyone like to see this added to the SDK at some point in the future? > > doValidate is a static method which required the formats array and the > country code to stored in static variables. It may be possible to add an > extra optional parameter to doValidate to get around this. Can anyone think > of another way of doing it? The ZipCodeValidator gets around this by hard > coding exact lengths and formats in the code but I don't thank that's > viable for a more generic class like this. > > For contribution like this what should the namespace be? mx.validators or > org.apache.flex.mx.validators or something else? > > Any interest in a similar spark version? > > Anyone want to help out by reviewing the code, writing more unit test (a > set of test for UK style postcodes would be useful) or any other way please > do so. > > Thanks, > Justin > > --000e0ce0d6724d7e9c04ba435f8a--