in reply to CGI table problems

You don't provide code, so how can we be sure? My guess is you're sending an arrayref to a td tag:
print $q->Tr( $q->td($arrayef) );
which will, of course, create a row of table cells. If you want them as a column instead you'll need to map them:
print map { $q->Tr( $q->td($_) ) } @{$arrayref};

Replies are listed 'Best First'.
Re^2: CGI table problems
by rashley (Scribe) on Nov 09, 2006 at 15:48 UTC
    I know, unfortunately I didn't provide code. The structure makes rounding up the pertinent parts difficult, but I'll give it a try.

    Here is where I gather the values and insert the array reference:

    my $noteshandler = $dbh->prepare($notessql); $noteshandler->execute($id, $version); while ( my @note = $noteshandler->fetchrow_arrayref() ) { push ( @noteslist, $note[0]); } $attrHashListRef->[$index]->{VALUE} = \@noteslist;

    Here is where I put my tables together:

    ###begin OUTER Table containing part list and selected part info $data .= $cgi->start_table({}); ###begin row in OUTER table. $data .= $cgi->start_Tr({}); ###Left most cell in OUTER table. Contains PartList. $data .= $cgi->td({-valign=>'top'}, renderPartListView($cgi)); ###begin Right cell in OUTER table. Contains Header and selected ###part info. $data .= $cgi->start_td({-valign=>'top' }); ###begin INNER table containing header and view $data .= $cgi->start_table({}); ###Top ROW on INNER table. Containing header $data .= $cgi->Tr({}, $cgi->td({}, pageHeader($cgi, $lca_dbm, $am))); ###begin bottom ROW on INNER table. Containing selected part $data .= $cgi->start_Tr({-width => 20, -style => 'white-space:wrap +'}); $data .= $cgi->td({-valign=>'top'}, renderPartReadView($cgi, $lca_dbm, $am) ###end bottom ROW on INNER table. Containing selected part $data .= $cgi->end_Tr({}); ###end INNER table containing header and view $data .= $cgi->end_table(); ###end Right cell in OUTER table. $data .= $cgi->end_td({}); ###end row in OUTER table. $data .= $cgi->end_Tr(); ###end OUTER Table containing part list and selected part info $data .= $cgi->end_table(); $logger->info("Exiting renderView"); return $data;

    Like I said, not pretty.

      Template it. That's a mess and will be even worse to maintain.
      Fixing a syntax error (missing ");" in the renderPartReadView line, substituting the embedded sub calls by their string representation, I got a table like

      renderPartListView($cgi)
      pageHeader($cgi, $lca_dbm, $am)
      renderPartReadView($cgi, $lca_dbm, $am)

      I'm still not sure where your problem resides. Assuming for now that renderPartListView returns an arrayref, and rather then seeing something like this:

      part1 part2 part3
      pageHeader($cgi, $lca_dbm, $am)
      renderPartReadView($cgi, $lca_dbm, $am)

      you would more like this:

      part0
      pageHeader($cgi, $lca_dbm, $am)
      renderPartReadView($cgi, $lca_dbm, $am)
      part1
      part2

      ???

      Well, it can be done… but is likely to obscure your programm even further.

      "Easiest" way I see (in the sense that you only make 1 local change) is introducing another table [:-/] for the left part, as in:

      part1
      part2
      part3
      pageHeader($cgi, $lca_dbm, $am)
      renderPartReadView($cgi, $lca_dbm, $am)

      To achieve that, replace the call to renderPartListView with the following:

      $cgi->table( map{ $cgi->Tr($cgi->td($_) ) } @{renderPartListView($cgi)} )
        Actually, the problem is within renderPartReadView.

        It creates a verticle list of label/value pairs, which is fine.

        The problem is when the value is a list, it puts the values side by side, and I want them stacked.