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?

Thanks,
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:

Code:
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" } );
return;
} else {
return @_;
}
}

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

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
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