diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 3d3143e19..ddcad44df 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,9 @@ - fixed: Calendar now uses the correct method to get the current user's time-zone - Shortcut ##userPref:## macros now work even if Shortcut is not under a Dashboard + - fixed backwards compatibility with new form control API additions: getValue is now + an alias to getValueFromForm instead of vice-versa. getValue is still the preferred + method, getValueFromForm is still the deprecated method. 7.5.17 - fixed: Payment Methods Hover Help Incomplete diff --git a/lib/WebGUI/Form/Control.pm b/lib/WebGUI/Form/Control.pm index f76a59f0c..b9085275a 100644 --- a/lib/WebGUI/Form/Control.pm +++ b/lib/WebGUI/Form/Control.pm @@ -400,14 +400,13 @@ An optional value to process, instead of POST input. =cut +# Note: This method calls getValueFromPost to maintain backwards compatibility. +# getValueFromPost is deprecated, use getValue sub getValue { - my ($self, $value) = @_; - return $value if (defined $value); - if ($self->session->request) { - $value = $self->session->form->param($self->get("name")); - return $value if (defined $value); - } - return $self->getDefaultValue; + my $self = shift; + my $value = shift; + return $value if defined $value; + return $self->getValueFromPost; } #------------------------------------------------------------------- @@ -447,9 +446,15 @@ Depricated. See getValue(). =cut +# Note: This method does the actual work of getValue for backwards compatibility +# getValueFromPost is deprecated, use getValue sub getValueFromPost { - my $self = shift; - return $self->getValue(@_); + my $self = shift; + if ($self->session->request) { + my $value = $self->session->form->param($self->get("name")); + return $value if (defined $value); + } + return $self->getDefaultValue; } #-------------------------------------------------------------------