Salil Gaikwad
2010-Jul-13 11:47 UTC
Zip code validation w/o using zip code database or javascrip
I want to validate that zip code entered by user is valid or not. for example user entered 009876654 and it is not valid then an error message should be given. I know i can do it using javascript regulr expression or using ajax-zip-code-database But i don''t want any of the above. i need some plugin sort of thing which send request to some online application to check wheather it is valid or not.I want this because i don''t want to take care if in future there is change in the zip-codes or new zip-codes get added. P.S. :- I don''t want to use javascript or using ajax-zip-code-database -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker
2010-Jul-13 16:20 UTC
Re: Zip code validation w/o using zip code database or javascrip
Salil Gaikwad wrote:> I want to validate that zip code entered by user is valid or not. > > for example user entered 009876654 and it is not valid then an error > message should be given. > > I know i can do it using javascript regulr expression or using > ajax-zip-code-database > > But i don''t want any of the above. i need some plugin sort of thing > which send request to some online application to check wheather it is > valid or not.I want this because i don''t want to take care if in future > there is change in the zip-codes or new zip-codes get added.The United States Postal Service has APIs for this, but you must first ask permission. http://www.usps.com/webtools/webtoolsapirequestform.htm -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Matt Jones
2010-Jul-16 01:23 UTC
Re: Zip code validation w/o using zip code database or javascrip
On Jul 13, 7:47 am, Salil Gaikwad <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I want to validate that zip code entered by user is valid or not. > > for example user entered 009876654 and it is not valid then an error > message should be given. > > I know i can do it using javascript regulr expression or using > ajax-zip-code-database > > But i don''t want any of the above. i need some plugin sort of thing > which send request to some online application to check wheather it is > valid or not.I want this because i don''t want to take care if in future > there is change in the zip-codes or new zip-codes get added. > > P.S. :- I don''t want to use javascript or using ajax-zip-code-databaseI think it depends entirely on what you''re planning to do with the zip code afterwards. - If you''re intending to feed it (along with the address, city and state) to a geocoder, most of those will complain if the zip isn''t valid. - If you''re trying to autofill city and state, you''re in for a tough time. See the discussion here: http://en.wikipedia.org/wiki/Postal_codes_in_the_United_States for a hint at the complexities involved. - If you''re just planning on storing it and showing it later, without interpreting it, you''re probably just better off cleaning it up to 5 digits (or 9, if you need Zip+4 - some people won''t know it...) and not worrying about it. To further add to the confusion, will your application have any Canadian users? --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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Diego Carrion
2010-Jul-16 03:15 UTC
Re: Re: Zip code validation w/o using zip code database or javascrip
Try using the GoMaps gem: http://github.com/gonow/go_maps With it you can do something like this: Address.new("009876654").exists? cheers On Thu, Jul 15, 2010 at 10:23 PM, Matt Jones <al2o3cr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Jul 13, 7:47 am, Salil Gaikwad <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > I want to validate that zip code entered by user is valid or not. > > > > for example user entered 009876654 and it is not valid then an error > > message should be given. > > > > I know i can do it using javascript regulr expression or using > > ajax-zip-code-database > > > > But i don''t want any of the above. i need some plugin sort of thing > > which send request to some online application to check wheather it is > > valid or not.I want this because i don''t want to take care if in future > > there is change in the zip-codes or new zip-codes get added. > > > > P.S. :- I don''t want to use javascript or using ajax-zip-code-database > > I think it depends entirely on what you''re planning to do with the zip > code afterwards. > > - If you''re intending to feed it (along with the address, city and > state) to a geocoder, most of those will complain if the zip isn''t > valid. > > - If you''re trying to autofill city and state, you''re in for a tough > time. See the discussion here: > > http://en.wikipedia.org/wiki/Postal_codes_in_the_United_States > > for a hint at the complexities involved. > > - If you''re just planning on storing it and showing it later, without > interpreting it, you''re probably just better off cleaning it up to 5 > digits (or 9, if you need Zip+4 - some people won''t know it...) and > not worrying about it. > > To further add to the confusion, will your application have any > Canadian users? > > --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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Diego Carrion http://www.diegocarrion.com http://www.mouseoverstudio.com/blog/ http://www.twitter.com/dcrec1 http://www.workingwithrails.com/person/13580-diego-carrion -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Jul-16 07:09 UTC
Re: Re: Zip code validation w/o using zip code database or javascrip
On 16 July 2010 02:23, Matt Jones <al2o3cr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Jul 13, 7:47 am, Salil Gaikwad <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I want to validate that zip code entered by user is valid or not. >... > To further add to the confusion, will your application have any > Canadian users?Or any other country with different format zip codes, the UK for example? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Salil Gaikwad
2010-Jul-16 07:19 UTC
Re: Re: Zip code validation w/o using zip code database or javascrip
Colin Law wrote:> On 16 July 2010 02:23, Matt Jones <al2o3cr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> On Jul 13, 7:47�am, Salil Gaikwad <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> I want to validate that zip code entered by user is valid or not. >>... >> To further add to the confusion, will your application have any >> Canadian users? > > Or any other country with different format zip codes, the UK for > example? > > ColinAt the moment i just want it for the US Only -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.