Hello People! Thought it was time to consult the resident LinksSQL gurus once again...
I've found a few threads on this topic but can't seem to find a solution suitable for my needs. Here's all I hope to accomplish:
- Users could submit / modify listings to multiple categorys via a multi select form in the include_form.html ( addition to 3 categorys only )
- Have Users somehow aware of what Categories they are currently listed in for modification purposes.
- To hopefully use some sort of global instead of code hacks for future updating ease.
Here's a thread and global I found on this topic:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=196090;#196090
Warwick from Humorlinks.com was nice enough to offer this global except it doesn't seen to work for me. It did show a few top categorys in which I was using SUB1 as a Description for use with the YahooSubcats Plugin. It didn't display as a multiselect form either. I removed those SUB1 in the Category Descriptions and no Categories would show at all.
I'm still trying to finish up my first LinksSQL project and I don't know enough to fix this global myself...
----------------------------------------------------------
From Humorlinks:
Hi.
This can be done by using a global.
Call it something like <%selected_cats%>
It will replace <%Category%> in include_form.html
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table('CatLinks');
my @sids = $db->select ( ['CategoryID'], { 'LinkID' => $id } )->fetchall_list;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Full_Name ASC');
my $sth = $cat_db->select ( { 'Description' => 'SUB1' }, ['ID', 'Full_Name'] );
my $output;
$output .= "<SELECT MULTIPLE SIZE='5' name='CatLinks.CategoryID'>";
$output .= "<option value=''>-------</option>";
while (my ($cid,$name) = $sth->fetchrow_array) {
$output .= "<option value='$cid'";
foreach my $sid (@sids) {
if ($sid eq $cid) {
$output .= " selected";
}
}
$output .= ">$name</option>";
}
$output .= "</SELECT>";
return $output;
}
----------------------------------------------------------
Many Many Many Thanks for any help getting some sort of multi select category option working in my include_form.html.
Ryan
I've found a few threads on this topic but can't seem to find a solution suitable for my needs. Here's all I hope to accomplish:
- Users could submit / modify listings to multiple categorys via a multi select form in the include_form.html ( addition to 3 categorys only )
- Have Users somehow aware of what Categories they are currently listed in for modification purposes.
- To hopefully use some sort of global instead of code hacks for future updating ease.
Here's a thread and global I found on this topic:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=196090;#196090
Warwick from Humorlinks.com was nice enough to offer this global except it doesn't seen to work for me. It did show a few top categorys in which I was using SUB1 as a Description for use with the YahooSubcats Plugin. It didn't display as a multiselect form either. I removed those SUB1 in the Category Descriptions and no Categories would show at all.
I'm still trying to finish up my first LinksSQL project and I don't know enough to fix this global myself...
----------------------------------------------------------
From Humorlinks:
Hi.
This can be done by using a global.
Call it something like <%selected_cats%>
It will replace <%Category%> in include_form.html
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table('CatLinks');
my @sids = $db->select ( ['CategoryID'], { 'LinkID' => $id } )->fetchall_list;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY Full_Name ASC');
my $sth = $cat_db->select ( { 'Description' => 'SUB1' }, ['ID', 'Full_Name'] );
my $output;
$output .= "<SELECT MULTIPLE SIZE='5' name='CatLinks.CategoryID'>";
$output .= "<option value=''>-------</option>";
while (my ($cid,$name) = $sth->fetchrow_array) {
$output .= "<option value='$cid'";
foreach my $sid (@sids) {
if ($sid eq $cid) {
$output .= " selected";
}
}
$output .= ">$name</option>";
}
$output .= "</SELECT>";
return $output;
}
----------------------------------------------------------
Many Many Many Thanks for any help getting some sort of multi select category option working in my include_form.html.
Ryan
