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 => '' }
This commit is contained in:
Colin Kuskie 2005-12-16 19:36:59 +00:00
parent 19dba14c44
commit 7167f97a92
2 changed files with 4 additions and 4 deletions

View file

@ -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) {

View file

@ -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, $_);
}