diff --git a/docs/upgrades/upgrade_5.2.6-5.3.0.sql b/docs/upgrades/upgrade_5.2.6-5.3.0.sql
index feb9daacf..80f2ef52c 100644
--- a/docs/upgrades/upgrade_5.2.6-5.3.0.sql
+++ b/docs/upgrades/upgrade_5.2.6-5.3.0.sql
@@ -582,6 +582,12 @@ delete from international where languageId=1 and namespace='WebGUI' and internat
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (977,1,'WebGUI','Is secondary admin?', 1053803387,'A flag indicating whether the users has secondary administrative privileges for this group.');
delete from international where languageId=1 and namespace='WebGUI' and internationalId=978;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (978,1,'WebGUI','User added successfully.', 1053804577,'A message used after secondary admin adds a user successfully.');
+delete from international where languageId=1 and namespace='DataForm' and internationalId=85;
+insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (85,1,'DataForm','One per line.', 1053855146,'Telling the user to add one entry per line.');
+delete from international where languageId=1 and namespace='DataForm' and internationalId=72;
+insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (72,1,'DataForm','You may add as many additional fields to your Data Form as you like.\r\n
\r\n\r\nLabel
\r\nThis is an informative text label to let the user know what this field represents.\r\n
\r\n\r\nField Name
\r\nThe name of this field. It must be unique among all of the other fields on your form.\r\n
\r\n\r\nSubtext
\r\nAn extension of the label, this is a description of what should go in the field or optional instructions for the field.\r\n
\r\n\r\nStatus
\r\nHidden fields will not be visible to the user, but will be sent in the email.Displayed fields can be seen by the user but not modified. Modifiable fields can be filled in by the user. Required fields must be filled in by the user.\r\nIf you choose Hidden or Displayed, be sure to fill in a Default Value.\r\n
\r\n\r\nType
\r\nChoose the type of form element for this field. \r\n
\r\n\r\nWidth
\r\nSet the number of characters wide this field will be.\r\n
\r\n\r\nHeight
\r\nSet the number of characters tall this field will be. Only used on textarea and HTMLArea.\r\n
\r\n\r\nPossible Values
\r\nThis field is used for the list types (like Checkbox List and Select List). Enter the values you wish to appear, one per line.\r\n
\r\n\r\nDefault Value (optional)
\r\nEnter the default value (if any) for the field. For Yes/No fields, enter "yes" to select "Yes" and "no" to select "No".\r\n
\r\n\r\n', 1053855075,NULL);
+delete from international where languageId=1 and namespace='DataForm' and internationalId=25;
+insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (25,1,'DataForm','Default Value(s)', 1053855043,NULL);
diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm
index f27642057..c15a44086 100644
--- a/lib/WebGUI/Form.pm
+++ b/lib/WebGUI/Form.pm
@@ -418,16 +418,12 @@ An array reference of field types to be displayed. The field names are the names
=item value
-The default value(s) for this form element. This should be passed as an array reference.
+The default value for this form element.
=item size
The number of characters tall this form element should be. Defaults to "1".
-=item multiple
-
-A boolean value for whether this select list should allow multiple selections. Defaults to "0".
-
=item extras
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
@@ -445,7 +441,7 @@ sub fieldType {
# without adult supervision. =) It was done this way because a huge
# if/elsif construct executes much more quickly than a bunch of
# unnecessary database hits.
- my @types = qw(dateTime time zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkboxList);
+ my @types = qw(dateTime time zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkList);
$_[0]->{types} = \@types unless ($_[0]->{types});
foreach $type (@{$_[0]->{types}}) {
if ($type eq "text") {
@@ -474,7 +470,7 @@ sub fieldType {
$hash{selectList} = WebGUI::International::get(484);
} elsif ($type eq "radioList") {
$hash{radioList} = WebGUI::International::get(942);
- } elsif ($type eq "checkboxList") {
+ } elsif ($type eq "checkList") {
$hash{checkboxList} = WebGUI::International::get(941);
} elsif ($type eq "zipcode") {
$hash{zipcode} = WebGUI::International::get(944);
@@ -482,11 +478,15 @@ sub fieldType {
$hash{checkbox} = WebGUI::International::get(943);
}
}
+ # This is a hack for reverse compatibility with a bug where this field used to allow an array ref.
+ my $value = $_[0]->{value};
+ unless ($value eq "ARRAY") {
+ $value = [$value];
+ }
return selectList({
options=>\%hash,
name=>$_[0]->{name},
value=>$_[0]->{value},
- multiple=>$_[0]->{multiple},
extras=>$_[0]->{extras},
size=>$_[0]->{size}
});
diff --git a/lib/WebGUI/FormProcessor.pm b/lib/WebGUI/FormProcessor.pm
index 6f2468e17..d711910aa 100644
--- a/lib/WebGUI/FormProcessor.pm
+++ b/lib/WebGUI/FormProcessor.pm
@@ -89,7 +89,7 @@ sub checkbox {
#-------------------------------------------------------------------
-=head2 checkboxList ( name )
+=head2 checkList ( name )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
@@ -103,7 +103,7 @@ The name of the form variable to retrieve.
=cut
-sub checkboxList {
+sub checkList {
return selectList($_[0]);
}
@@ -204,7 +204,7 @@ sub email {
=head2 fieldType ( name )
-Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar. Defautls to "text".
+Returns a field type. Defaults to "text".
=over
@@ -217,7 +217,7 @@ The name of the form variable to retrieve.
=cut
sub fieldType {
- return (selectList($_[0]) || "text");
+ return ($session{form}{$_[0]} || "text");
}
diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm
index 973defccb..f2d7cf503 100644
--- a/lib/WebGUI/HTMLForm.pm
+++ b/lib/WebGUI/HTMLForm.pm
@@ -621,7 +621,7 @@ sub email {
#-------------------------------------------------------------------
-=head2 fieldType ( name, types [ label, value, size, multiple, extras, subtext, uiLevel ] )
+=head2 fieldType ( name, types [ label, value, size, extras, subtext, uiLevel ] )
Adds a field type select list field to this form. This is primarily useful for building dynamic form builders.
@@ -641,16 +641,12 @@ The left column label for this form row.
=item value
-The default value(s) for this form element. This should be passed as an array reference.
+The default value for this form element.
=item size
The number of characters tall this form element should be. Defaults to "1".
-=item multiple
-
-A boolean value for whether this select list should allow multiple selections. Defaults to "0".
-
=item extras
If you want to add anything special to this form element like javascript actions, or stylesheet information, you'd add it in here as follows:
diff --git a/lib/WebGUI/Wobject/DataForm.pm b/lib/WebGUI/Wobject/DataForm.pm
index fef45e112..1381d6fb0 100644
--- a/lib/WebGUI/Wobject/DataForm.pm
+++ b/lib/WebGUI/Wobject/DataForm.pm
@@ -44,19 +44,19 @@ sub _createField {
if ($data->{type} eq "checkbox") {
$param{value} = ($data->{defaultValue} =~ /checked/i) ? 1 : "";
}
- if (isIn($data->{type},qw(selectList checkboxList))) {
+ if (isIn($data->{type},qw(selectList checkList))) {
my @defaultValues;
if ($session{form}{$param{name}}) {
@defaultValues = $session{cgi}->param($param{name});
} else {
- foreach (split(/\n/, $data->{defaultValue})) {
+ foreach (split(/\n/, $data->{value})) {
s/\s+$//; # remove trailing spaces
push(@defaultValues, $_);
}
}
$param{value} = \@defaultValues;
}
- if (isIn($data->{type},qw(selectList checkboxList radioList))) {
+ if (isIn($data->{type},qw(selectList checkList radioList))) {
delete $param{size};
my %options;
tie %options, 'Tie::IxHash';
@@ -431,12 +431,14 @@ sub www_editField {
$f->textarea(
-name=>"possibleValues",
-label=>WebGUI::International::get(24,$_[0]->get("namespace")),
- -value=>$field{possibleValues}
+ -value=>$field{possibleValues},
+ -subtext=>'
'.WebGUI::International::get(85,$_[0]->get("namespace"))
);
$f->textarea(
-name=>"defaultValue",
-label=>WebGUI::International::get(25,$_[0]->get("namespace")),
- -value=>$field{defaultValue}
+ -value=>$field{defaultValue},
+ -subtext=>'
'.WebGUI::International::get(85,$_[0]->get("namespace"))
);
if ($session{form}{fid} eq "new") {
$f->whatNext(