From 7167f97a92cc32e51ab6c00a8446a24f10ec18d9 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 16 Dec 2005 19:36:59 +0000 Subject: [PATCH] Fix a bug where List-type Forms created via DynamicField did not use default values from the Form itself. If you truly want a List with no defaults, pass in an empty string on the value key in the param hash: { value => '' } --- lib/WebGUI/Form/DynamicField.pm | 2 +- lib/WebGUI/Form/List.pm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/WebGUI/Form/DynamicField.pm b/lib/WebGUI/Form/DynamicField.pm index b6f9f76e7..10070830f 100644 --- a/lib/WebGUI/Form/DynamicField.pm +++ b/lib/WebGUI/Form/DynamicField.pm @@ -114,7 +114,7 @@ sub new { ##List type forms. Historically, dynamically created forms have always ##used the default size. if ($formObj->isa('WebGUI::Form::List')) { - $formObj->correctValues(); + $formObj->correctValues($param->{value}); $formObj->correctOptions($param->{possibleValues}); } elsif ($size) { diff --git a/lib/WebGUI/Form/List.pm b/lib/WebGUI/Form/List.pm index 88d9a4eea..a1a04acb0 100644 --- a/lib/WebGUI/Form/List.pm +++ b/lib/WebGUI/Form/List.pm @@ -91,10 +91,10 @@ method. =cut sub correctValues { - my ($self) = @_; - return unless defined $self->{value}; + my ($self, $value) = @_; + return unless defined $value; my @defaultValues; - foreach (split(/\n/, $self->{value})) { + foreach (split(/\n/, $value)) { s/\s+$//; # remove trailing spaces push(@defaultValues, $_); }