From 6a3d1588befb0c3a693739ed74af351d620a0755 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 24 Sep 2009 09:31:42 -0700 Subject: [PATCH] Uppercase any lowercase zipcode letters entered. Fixes 11018. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Form/Zipcode.pm | 4 +++- t/Form/Zipcode.t | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 48a4d1719..e5320a989 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -6,6 +6,7 @@ - fixed #11031: AssetProxy refering to trash-limbo asset - fixed #11028: IOB: Not choosing status causes Problem With Request - fixed #11029: enableStreamingUploads + - fixed #11018: no lowercase typing possible in addressbook 7.8.0 - upgraded YUI to 2.8.0r4 diff --git a/lib/WebGUI/Form/Zipcode.pm b/lib/WebGUI/Form/Zipcode.pm index f47e25de0..75e15561d 100644 --- a/lib/WebGUI/Form/Zipcode.pm +++ b/lib/WebGUI/Form/Zipcode.pm @@ -82,6 +82,7 @@ sub getName { =head2 getValue ( [ value ] ) Returns a validated form post result. If the result does not pass validation, it returns undef instead. +Uppercases any lowercase letters. =head3 value @@ -93,6 +94,7 @@ sub getValue { my $self = shift; my $value = $self->SUPER::getValue(@_); $value =~ tr/\r\n//d; + $value =~ tr/a-z/A-Z/d; if ($value =~ /^[A-Z\d\s\-]+$/) { return $value; } @@ -122,7 +124,7 @@ Renders a zip code field. sub toHtml { my $self = shift; $self->session->style->setScript($self->session->url->extras('inputCheck.js'),{ type=>'text/javascript' }); - $self->set("extras", $self->get('extras') . ' onkeyup="doInputCheck(document.getElementById(\''.$self->get("id").'\'),\'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ- \')"'); + $self->set("extras", $self->get('extras') . ' onkeyup="doInputCheck(document.getElementById(\''.$self->get("id").'\'),\'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz- \')"'); return $self->SUPER::toHtml; } diff --git a/t/Form/Zipcode.t b/t/Form/Zipcode.t index 8319cc44b..ecc53f32e 100644 --- a/t/Form/Zipcode.t +++ b/t/Form/Zipcode.t @@ -55,7 +55,7 @@ my $testBlock = [ { key => 'Zip5', testValue => 'abcde', - expected => undef, + expected => 'ABCDE', comment => 'lower case', }, ];