Indian Pin Codes Not Validated correctly

acushla - March 27, 2008 - 16:03
Project:CCK Address Extensions
Version:5.x-1.6
Component:India-Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hi,

I am using the Indian Address Extensions. I realized that the module does not allow the submission of correct Indian PIN(ZIP) codes. Looking into the code in the module: drupal/modules/cck_address_extensions/india/cck_address_india.module line number 163:
if (($item['zip'] != '') && (!preg_match("^[1-9]{3}\s{0,1}[0-9]{3}$", $item['zip']))) {//zip code is 6 digits with a possible space after third. first set is 1-9, second is 0-9
the volidation criteria is incorrect for India. I got the validation working correctly by altering the line to
if (($item['zip'] != '') && (!preg_match("^[1-9]{1}\s{0,1}[0-9]{5}$", $item['zip']))) {//zip code is 6 digits with a possible space after third. first digit is 1-9, all others are 0-9

Hope it is useful and can be included in next patch/release.

Cheers

Rajat
www.sankalpindia.net

#1

rconstantine - April 8, 2008 - 00:56
Status:active» needs review

I'll review this when I get a chance.

 
 

Drupal is a registered trademark of Dries Buytaert.