
bugzilla-daemon at bricolage-bugzilla
Feb 15, 2002, 11:22 PM
Post #1 of 1
(112 views)
Permalink
|
|
[Bricolage-Bugs] [Bug 108] New: multiple select boxes in elements passing ARRAYREF, not storing.
|
|
Summary: multiple select boxes in elements passing ARRAYREF, not storing. Product: Bricolage Version: 1.2.0 - Current Release Platform: IE 5.5 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Components AssignedTo: dw [at] dnai ReportedBy: slattery [at] angel I found that in my Release_1_2 install that when I populated a multiple select box that a) it passed an ARRAYREF to DBI, and failed to store my selections. b) as a consequence, the select display box was not displaying my choices during a later visit. I am sure there are better ways to deal with this, but here is my quick fix: Bric.pm -------- I used Data::Dumper to make sure I not dealing with a sneaky and complex object. I took the dump and created a delimited string, and stored it in the pgdb. slattery [at] linux:diff /home/slattery/bric_cvs/bricolage/lib/Bric.pm ./Bric.pm 758d757 < 761a761,775 > > # the multiple selects hurt us when we hand off the arrayref to DBI > # luckily, Data::Dumper feeds on arrayrefs. > > if (ref($self->{$keys[$i]}) eq 'ARRAY' && $keys[$i] eq '_short_val' ){ > use Data::Dumper; > my $d = Data::Dumper->new($self->{$keys[$i]}); > $d->Terse(1); > $d->Indent(0); > my $_refdump = $d->Dump; > chomp $_refdump; > $_refdump =~ s/''/__OPT__/g; $_refdump =~ s/^'//; $_refdump = ~ s/'$//; > $self->{$keys[$i]} = $_refdump; > print STDERR "$_refdump\n"; > } displayFormElement.mc --------------------- When we want to display the multiple select, we grab the value and split it, and cycle through the selections to make sure that they are highlighted. Now, searching on them in a template is a problem of knowing the delimiter. There must be a more direct route... Cheers, Nike slattery [at] linux:diff /home/slattery/bric_cvs/bricolage/comp/widgets/ profile/displayFormElement.mc ./displayFormElement.mc 195a196 > 198,200c199,217 < # select it if there's a match < $out .= " selected" if $k eq $value; < return "$out>$v</option>\n"; --- > > > if ($value =~ /__OPT__/){ > my @multiple_opts = split(/__OPT__/, $value); > my $m; > foreach $m( @multiple_opts ){ > # select it if there's a match > $out .= " selected" if $k eq $m; > } > > } else { > > # select it if there's a match > $out .= " selected" if $k eq $value; > } > > $out .= ">$v</option>\n"; > return "$out"; > http://bricolage-bugzilla.thepirtgroup.com/show_bug.cgi?id=108 _______________________________________________ Bricolage-Bugs mailing list Bricolage-Bugs [at] lists https://lists.sourceforge.net/lists/listinfo/bricolage-bugs
|