Hi All,

How to validate Zip/Postal code enterd is valid based on country
selected? Is there any plugin for checking zipcode format for different
countries..

Thanks

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Ahmy Yulrizka at Jan 6, 2012 at 11:42 am

    On Fri, Jan 6, 2012 at 5:36 PM, savitha sreekumar wrote:

    Hi All,

    How to validate Zip/Postal code enterd is valid based on country
    selected? Is there any plugin for checking zipcode format for different
    countries..

    Thanks
    I dont know on country level, but on US you can check this gem
    http://rubygems.org/gems/zip-code-info

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Matt Jones at Jan 7, 2012 at 3:31 pm

    On Jan 6, 5:36 am, savitha sreekumar wrote:
    Hi All,

    How to validate Zip/Postal code enterd is valid based on country
    selected? Is there any plugin for checking zipcode format for different
    countries..
    Depends on what you want the postcode for. If it's for something like
    geocoding, you might be better off relying on the geocoder to validate
    the input.

    There's some stuff about this, but the validation is ultimately
    country-specific (and can change - apparently Ireland is debating the
    creation of a postcode system):

    - https://github.com/globaldev/going_postal - validates postcodes for
    UK, US, Canada, Australia, New Zealand, and South Africa
    - http://search.cpan.org/~abigail/Regexp-Common-2011121001/lib/Regexp/Common/zip.pm
    - not directly applicable, but this is a Perl module with regexes for
    more countries. The syntax should translate readily to Ruby

    Hope this helps!

    --Matt Jones

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 6, '12 at 10:37a
activeJan 7, '12 at 3:31p
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase