Gossamer Forum
Home : Products : Gossamer Links : Discussions :

multiple categories - limit selections?

Quote Reply
multiple categories - limit selections?
Hi All-

I know that it is possible to allow users to select multiple categories when submitting a link.

What I am wondering is if there is an easy way to limit the number of categories they can select?

Say for example I have 15 categories and I want to allow users to submit their link to either one or two of those categories. But not more than two.

Is there a simple way to accomplish that?

Matt G
Quote Reply
Re: [Matt G] multiple categories - limit selections? In reply to
The easiest way would be with a plugin, something like a hook on add_link PRE and modify_link PRE, with some code like:

sub check_add {
my @cat_ids = $IN->param('CatLinks.CategoryID');
if (@cat_ids > 2) {
print $IN->header;
print Links::SiteHTML::display('add', { error => "Please only select 2 categories" } );
} else {
return @_;

You would really need one of those per event (or a way of deciding which template to show)

Hope that helps


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] multiple categories - limit selections? In reply to
Thank you Andy.

Makes sense. Ideally the form itself would give an alert, but an error on submission will probably work ok.

I'll have to look into Ajax a bit, I'm really unfamiliar with that, but maybe there is a way to use that or javascript now that I think about it.
Matt G