EMS import/export, Form::*::getValueFromPost(alt_values), and tests

This commit is contained in:
James Tolley 2007-05-29 23:39:24 +00:00
parent 0a7e06edca
commit c09b2cae1b
46 changed files with 1728 additions and 299 deletions

View file

@ -70,19 +70,23 @@ sub definition {
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
=head2 getValueFromPost ( [ value ] )
Returns a string filtered to allow only digits, spaces, and these special characters: + - ( ) or it will return undef it the number doesn't validate to those.
=head3 value
An input value to use instead of POST input.
=cut
sub getValueFromPost {
my $self = shift;
my $value = $self->session->form->param($self->get("name"));
if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
return $value;
}
return undef;
my $value = @_ ? shift : $self->session->form->param($self->get("name"));
if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
return $value;
}
return undef;
}
#-------------------------------------------------------------------