hi,
the use the following global my add/modify.it works perfectly. Also when people select to place their links in multiple categories, it will do this.however when they go to modify that link, only one category shows as selected them to modify form. how can I change this so that it shows all the categories that the link is associated with in the multiple select form
sub {
my $catid = shift;
my $show_count = $_[0];
my $in_id = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
my $table = $DB->table('Category') || return $GT::SQL::error;
my $back;
$table->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $cond = GT::SQL::Condition->new('menuShow','=','Yes');
my $sth = $table->select( ['ID','Full_Name','Number_of_Links'], $cond) || return $GT::SQL::error;
while (my ($id,$full_name,$numberoflinks) = $sth->fetchrow_array) {
my $full_name2;
my @cut = split /\//, $full_name;
for (my $i=0; $i < $#cut; $i++) {
$full_name2 .= " ";
}
$full_name2 .= $cut[$#cut];
if ($show_count) {
$full_name2 .= " ($numberoflinks)";
}
$back .= "<option value=\"$id\"";
if ($in_id == $id) { $back .= "selected=\"selected\""; }
$back .= ">$full_name2</option>";
}
my $send_back = qq|<select MULTIPLE SIZE="5" name="CatLinks.CategoryID"><option value="">------</option>$back</select>|;
return $send_back;
}
cheers,
the use the following global my add/modify.it works perfectly. Also when people select to place their links in multiple categories, it will do this.however when they go to modify that link, only one category shows as selected them to modify form. how can I change this so that it shows all the categories that the link is associated with in the multiple select form
sub {
my $catid = shift;
my $show_count = $_[0];
my $in_id = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
my $table = $DB->table('Category') || return $GT::SQL::error;
my $back;
$table->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $cond = GT::SQL::Condition->new('menuShow','=','Yes');
my $sth = $table->select( ['ID','Full_Name','Number_of_Links'], $cond) || return $GT::SQL::error;
while (my ($id,$full_name,$numberoflinks) = $sth->fetchrow_array) {
my $full_name2;
my @cut = split /\//, $full_name;
for (my $i=0; $i < $#cut; $i++) {
$full_name2 .= " ";
}
$full_name2 .= $cut[$#cut];
if ($show_count) {
$full_name2 .= " ($numberoflinks)";
}
$back .= "<option value=\"$id\"";
if ($in_id == $id) { $back .= "selected=\"selected\""; }
$back .= ">$full_name2</option>";
}
my $send_back = qq|<select MULTIPLE SIZE="5" name="CatLinks.CategoryID"><option value="">------</option>$back</select>|;
return $send_back;
}
cheers,