Possible fix for postcode validator not working all the time
This commit is contained in:
parent
ae6884202a
commit
7614b7bc2e
1 changed files with 3 additions and 2 deletions
|
@ -32,8 +32,9 @@ sub register {
|
||||||
try {
|
try {
|
||||||
$postcode = Geo::UK::Postcode->new( $value );
|
$postcode = Geo::UK::Postcode->new( $value );
|
||||||
};
|
};
|
||||||
return defined( $postcode ) && ( $postcode->valid ) && ! ( $postcode->partial ) ? undef : 1;
|
return 1 unless defined( $postcode );
|
||||||
|
return 1 if $postcode->partial;
|
||||||
|
return undef if $postcode->valid;
|
||||||
});
|
});
|
||||||
|
|
||||||
$app->validator->add_check( number => sub {
|
$app->validator->add_check( number => sub {
|
||||||
|
|
Reference in a new issue