merging form pollution fix

This commit is contained in:
JT Smith 2008-04-16 21:55:38 +00:00
parent c1cab2299c
commit 11e4f6ea7e
78 changed files with 2666 additions and 1463 deletions

View file

@ -50,34 +50,36 @@ The following additional parameters have been added via this sub class.
Defaults to 10. Determines the maximum number of characters allowed in this field.
=head4 profileEnabled
Flag that tells the User Profile system that this is a valid form element in a User Profile
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift || [];
my $i18n = WebGUI::International->new($session);
push(@{$definition}, {
formName=>{
defaultValue=> $i18n->get("944")
},
maxlength=>{
defaultValue=> 10
},
profileEnabled=>{
defaultValue=>1
},
});
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( [ value ] )
=head2 getName ( session )
Returns the human readable name of this control.
=cut
sub getName {
my ($self, $session) = @_;
return WebGUI::International->new($session, 'WebGUI')->get('944');
}
#-------------------------------------------------------------------
=head2 getValue ( [ value ] )
Returns a validated form post result. If the result does not pass validation, it returns undef instead.
@ -87,9 +89,9 @@ An optional value to use instead of POST input.
=cut
sub getValueFromPost {
sub getValue {
my $self = shift;
my $value = @_ ? shift : $self->session->form->param($self->get("name"));
my $value = $self->SUPER::getValue(@_);
$value =~ tr/\r\n//d;
if ($value =~ /^[A-Z\d\s\-]+$/) {
return $value;
@ -99,6 +101,18 @@ sub getValueFromPost {
#-------------------------------------------------------------------
=head2 isDynamicCompatible ( )
A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
=cut
sub isDynamicCompatible {
return 1;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a zip code field.