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

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