Replace new getValueFromPost with original. Checked that
Posts have all values (username, dateSubmitted, dateUpdated) defined.
This commit is contained in:
parent
53a1475c4b
commit
fadb77822e
3 changed files with 38 additions and 12 deletions
|
|
@ -367,24 +367,18 @@ sub fixTags {
|
|||
|
||||
=head2 getValueFromPost ( )
|
||||
|
||||
Retrieves a value from a form GET or POST and returns it. If the value
|
||||
comes back as undef, this method will return the defaultValue instead.
|
||||
It also handles return data in list or scalar contexts. If a Form
|
||||
field that supports multiple select requests its values in scalar
|
||||
context, it will return a newline "\n" separated scalar.
|
||||
Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
my @formValues = $session{req}->param($self->{name});
|
||||
return undef if ($formValues[0] eq "");
|
||||
unless (@formValues) {
|
||||
@formValues = (ref $self->{defaultValue} eq "ARRAY")
|
||||
? @{$self->{defaultValue} }
|
||||
: ( $self->{defaultValue} );
|
||||
my $formValue = $session{req}->param($self->{name});
|
||||
if (defined $formValue) {
|
||||
return $formValue;
|
||||
} else {
|
||||
return $self->{defaultValue};
|
||||
}
|
||||
return wantarray ? @formValues : join("\n",@formValues);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -183,6 +183,20 @@ sub displayValue {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValueFromPost ( )
|
||||
|
||||
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
my @data = $session{req}->param($self->{name});
|
||||
return wantarray ? @data : join("\n",@data);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValues ( )
|
||||
|
||||
Safely handle returning values whether the stored data is scalar or an array
|
||||
|
|
|
|||
|
|
@ -86,6 +86,24 @@ sub definition {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValueFromPost ( )
|
||||
|
||||
Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead. Note, this is exactly the same method as used by Control since SelectBoxes only support a single value.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
my $formValue = $session{req}->param($self->{name});
|
||||
if (defined $formValue) {
|
||||
return $formValue;
|
||||
} else {
|
||||
return $self->{defaultValue};
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders a select list form control.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue