Fixed select slider and key/value pair support for list type form elements in Thingy

This commit is contained in:
Yung Han Khoe 2008-10-06 08:38:06 +00:00
parent 77d62f837f
commit 20e561788b
3 changed files with 30 additions and 9 deletions

View file

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

View file

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

View file

@ -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. <br />
<br />If you want a different label for a value, the possible values list has to be
formatted as follows:
<pre>
&#123;
"key1"=>"value1",
"key2"=>"value2",
"key3"=>"value3"
...
&#125;
</pre>
Braces, quotes and all. You simply replace "key1"/"value1" with your own name/value pairs},
lastUpdated => 1104630516,
},