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 624FC9847 for ; Thu, 1 Mar 2012 05:17:55 +0000 (UTC) Received: (qmail 40153 invoked by uid 500); 1 Mar 2012 05:17:54 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 39926 invoked by uid 500); 1 Mar 2012 05:17:51 -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 39901 invoked by uid 99); 1 Mar 2012 05:17:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 05:17:51 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of davidbuhler@gmail.com designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 05:17:45 +0000 Received: by iaag37 with SMTP id g37so328168iaa.6 for ; Wed, 29 Feb 2012 21:17:25 -0800 (PST) Received-SPF: pass (google.com: domain of davidbuhler@gmail.com designates 10.50.203.98 as permitted sender) client-ip=10.50.203.98; Authentication-Results: mr.google.com; spf=pass (google.com: domain of davidbuhler@gmail.com designates 10.50.203.98 as permitted sender) smtp.mail=davidbuhler@gmail.com; dkim=pass header.i=davidbuhler@gmail.com Received: from mr.google.com ([10.50.203.98]) by 10.50.203.98 with SMTP id kp2mr3362945igc.5.1330579045404 (num_hops = 1); Wed, 29 Feb 2012 21:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Imf0tyfd47uflPmArh2jR0sIl5v5B3lRXxQ9hz2pdqw=; b=hzl6dKTYQlnCktzQdEG0hxF70dt4IHiw+QaoJ4uIp7sO5mcYl3Ys49MvDsoQdBc/CC xBJBWm6Mebx5jaWyHk6GbWYAhnNOGOqcEqnpJOpRUKdeu1NRUwDqM2IkyeZPjbqJDA0h Y+n7gCpMnM41bir5QsDXlqrVXr+3bG5Dnwic4= MIME-Version: 1.0 Received: by 10.50.203.98 with SMTP id kp2mr2765020igc.5.1330579045359; Wed, 29 Feb 2012 21:17:25 -0800 (PST) Received: by 10.50.126.3 with HTTP; Wed, 29 Feb 2012 21:17:25 -0800 (PST) In-Reply-To: References: Date: Thu, 1 Mar 2012 00:17:25 -0500 Message-ID: Subject: Re: mx PostCode validator class From: David Francis Buhler To: flex-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=14dae9340767581ef804ba279378 X-Virus-Checked: Checked by ClamAV on apache.org --14dae9340767581ef804ba279378 Content-Type: text/plain; charset=ISO-8859-1 That's cool! For a Postal Code validator, I believe you'll need a thorough suite of tests to validate (pun!) that the class works for the wide variety of Postal Formats. Is there an ISO-Standard for Postal Codes? Or perhaps an agreed upon standard for Formats for each country-code? 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 > > --14dae9340767581ef804ba279378--