Posted on 2008-05-05 07:24:38-07 by fzimmer
Some questions about
Hi all, just I try to use HTML::TreeView for my Website. I filled it with records from a database. Now I want to call the menu closed. That means that all folders are closed when I call the menu. In every example the menu is complete opened if I call it. The second thing is to select multiple items of the menu. I want to have the possibility to select more than one item of the menu and send the form with a SEND-button to another perl-script that processes the selected values from the tree. Hope that someone can help me!!! greez fzimmer
Direct Responses: 7824 | Write a response
Posted on 2008-05-06 19:01:41-07 by linze in response to 7816
Re: Some questions about
Some questions about Hi all, just I try to use HTML::TreeView for my Website. I filled it with records from a database. Now I want to call the menu closed. That means that all folders are closed when I call the menu. In every example the menu is complete opened if I call it. If you want a Closed folder try something like.
#!/usr/bin/perl -w use HTML::Menu::TreeView; use CGI ; use strict; my @tree = ( { onclick => "alert('onclick');", text => 'onclick', }, { text => 'Html::Menu::TreeView', href => "./open.pl?open=1", empty =>1 , # this is the important line } ); my $TreeView = new HTML::Menu::TreeView(); my $q = new CGI; $tree[1]{subtree} =[{text => 'treeview.tigris.org', href => 'http://treeview.tigris.org', target => + '_parent',}, {text => 'Examples', subtree => [{text => 'FO Syntax', href => './fo.pl',},],},] if( + $q ->param('open')); print $q->header, $q->start_html(-title => 'OO', -script => $TreeView->jscript() . $TreeView->prelo +ad(), -style => {-code => $TreeView->css()}), $TreeView->Tree(\@tree), $q->end_html;
The second thing is to select multiple items of the menu. I want to have the possibility to select more than one item of the menu and send the form with a SEND-button to another perl-script that processes the selected values from the tree. Hope that someone can help me!!! greez fzimmer
#!/usr/bin/perl -w use HTML::Menu::TreeView; use CGI qw (Vars); use strict; my $q = new CGI ; my @tree = ( { text => $q->checkbox(-name=>'First', -value=>'what', -label=>'First'), title => 'must be set', #if you dont set a title the item text will be used }, { text => $q->checkbox(-name=>'Whatever', -value=>'whatever', ), title => 'must be set', #if you dont set a title the item text will be used } ); my $TreeView = new HTML::Menu::TreeView(); print $q->header, $q->start_html(-title => 'Select', -script => $TreeView->jscript() . $TreeView->preload(), -sty +le => {-code => $TreeView->css()}), $q->start_form(-method => "get", -action => "$ENV{SCRIPT_NAME}",), $q->hidden({-name => 'action'}, 'select'), $TreeView->Tree(\@tree), $q->submit(-name=> 'submit',-value => 'Select'), $q->end_form; if($q->param('submit')){ print "submit",$q->br() ; my %params = Vars(); foreach my $key (sort(keys %params)) { print $params{$key},$q->br() unless $key eq 'submit'; } } print $q->end_html;
greetz Dirk
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.