in reply to Re^3: Help with CGI::WIDGET::TABS
in thread Help with CGI::WIDGET::TABS

That solved it poj. I think I'm real close to accomplishing the task of being able to click on each tab to go to a different page so to speak. However, I see the default tab of Football along with the corresponding URL's, but when I click on the BASEBALL Tab nothing happens

Content-Type: text/html 'FOOTBALL' 'BASEBALL' Patriots http://www.patriots.com Bengals http://www.bengals.com Ravens http://www.ravens.com Steelers http://www.steelers.com

Any idea what I could be missing?

thanks again. I really appreciate your help

Replies are listed 'Best First'.
Re^5: Help with CGI::WIDGET::TABS
by poj (Abbot) on Aug 03, 2017 at 16:45 UTC

    If you look at the page source you should see something like this

    <!-- Generated by CGI::Widget::Tabs v1.14 --> <table class="tab"> <tr> <td class="tab_spc"></td> <td class="tab"><a href="?tab=Football">Football</a></td><td class="ta +b_spc"></td> <td class="tab_actv"><a href="?tab=Baseball">Baseball</a></td><td clas +s="tab_spc"></td> </tr> </table> <!-- End CGI::Widget::Tabs v1.14 -->
    poj

      I have something similar to you:

      <!-- Generated by CGI::Widget::Tabs v1.14 --> <table class="tab"> <tr> <td class="tab_spc"></td> <td class="tab"><a href="?tab=%26%2339%3BPROD_RTP%26%2339%3B">&#39;PRO +D_RTP&#39;</a></td><td class="tab_spc"></td> <td class="tab"><a href="?tab=%26%2339%3BPROD_OMA%26%2339%3B">&#39;PRO +D_OMA&#39;</a></td><td class="tab_spc"></td> </tr> </table>

      Using my business example, One thing I notice is that I don't have the "tab_actv" like you do. Also, for my underlying html data that each tab would reference, I'm only getting the ROW data for my first tab (PROD_RTP). Wouldn't I need a loop of some sort to generate the sql results from all the headings? The code below only prints the html from the results of the value from $tab->active, which in my case is whatever is assigned as default...for example: $tab->default("PROD_RTP"). If I expand the webpage to include several more tabs, how does the database handle statement (my $sth = $dbh->prepar($sql)) execute each query to render the html? Just seems like I need a loop.

      my $sth = $dbh->prepare($sql); $sth->execute($tab->active); my @rows; while (my @f = $sth->fetchrow_array) { push @rows, { CLIENT => $f[0], URL => $f[1], }; } my $script="$ENV{'HOME'}/scripts/template.pl"; my $template = HTML::Template->new(filename => $script); $template->param(TITLE=>'ENV Spreadsheet'); $template->param(HEADINGS=>$heading, ROWS=>\@rows );

      In the hypothetical Football and Baseball example, the rest of the html output would have the ROW data for Teams and their associated URL. When you click on the Baseball Tab, How does the Baseball tab know that the Baseball teams and baseball team URLS belong to said tab?

      Thanks for your time poj.

        How are you creating the headings here, $tab->headings( ??? ) ?

        they appear to have single quotes ' (html encoded as &#39;) around them