diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d81f8f9f4..e5a3f4ce5 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,8 @@ - fixed: DataForm doesn't keep posted values properly when data fails validation - fixed: Documentation for DataForm and Thingy updated for Possible Values field - added a new permission denied page for version tag approval + - fixed: Thingy list type form elements do not support key/value pairs + - fixed: Select Slider borked in Thingy - fixed: Shortcuts includes HTML head data twice - fixed: DataForm entry table isn't properly indexed - fixed: DataForm can't export fields containing newlines diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index 72570b6a0..fc1a9a3d9 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -830,7 +830,7 @@ sub getFormElement { } } - if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments SelectSlider))) { + if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments))) { my @defaultValues; if ($self->session->form->param($name)) { @defaultValues = $self->session->form->selectList($name); @@ -844,15 +844,22 @@ sub getFormElement { $param{value} = \@defaultValues; } - if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList SelectBox CheckList RadioList))) { + if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList SelectBox CheckList RadioList SelectSlider))) { delete $param{size}; - my %options; - tie %options, 'Tie::IxHash'; - foreach (split(/\n/x, $data->{possibleValues})) { - s/\s+$//x; # remove trailing spaces - $options{$_} = $_; + + my $values = WebGUI::Operation::Shared::secureEval($self->session,$data->{possibleValues}); + if (ref $values eq 'HASH') { + $param{options} = $values; + } + else{ + my %options; + tie %options, 'Tie::IxHash'; + foreach (split(/\n/x, $data->{possibleValues})) { + s/\s+$//x; # remove trailing spaces + $options{$_} = $_; + } + $param{options} = \%options; } - $param{options} = \%options; } if ($data->{fieldType} eq "YesNo") { diff --git a/lib/WebGUI/i18n/English/Asset_Thingy.pm b/lib/WebGUI/i18n/English/Asset_Thingy.pm index 021390fa5..d63074a94 100644 --- a/lib/WebGUI/i18n/English/Asset_Thingy.pm +++ b/lib/WebGUI/i18n/English/Asset_Thingy.pm @@ -529,7 +529,19 @@ vertically.|, }, 'possible values description' => { - message => q{This field is used for the list types (like Checkbox List and Select List). Enter the values you wish to appear, one per line. If you want a different label for a value, seperate them with a | (pipe) character: value|label }, + message => q{This field is used for the list types (like Checkbox List and Select List). Enter the values +you wish to appear, one per line.
+
If you want a different label for a value, the possible values list has to be +formatted as follows: +
+{
+   "key1"=>"value1",
+   "key2"=>"value2",
+   "key3"=>"value3"
+   ...
+}
+
+Braces, quotes and all. You simply replace "key1"/"value1" with your own name/value pairs}, lastUpdated => 1104630516, },