Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Multiple Category Modify

Quote Reply
Multiple Category Modify
Hi-

I've set up my add form so that people can add into multiple categories with check boxes. I don't have a lot of change in the categories on this directory, so I hard coded the check boxes using CatLinks.CategoryID and then specifying the the appropriate value for the category. This works great for letting users add their links into several multiple categories by themselves from the add form.

The problem is on the user modify process. Is there any way to have the checkboxes come up checked for the specific category ID numbers? I tried the following:

<input type="checkbox"
name="CatLinks.CategoryID" value="25"
<%if CatLinks.CategoryID like '25'%>checked<%endif%>>

But that didn't work even if the link was in the category with the Category ID number 25.

Does anyone know if there is any way to do this? I've been struggling with it all day, and can't seem to come up with an answer...

--jw



Quote Reply
Re: Multiple Category Modify In reply to
Hi Frank,

I can help you with this with. I will send to you the modified add.cgi file asap.

Regards,

Mark

Quote Reply
Re: Multiple Category Modify In reply to
Hi,

The template system won't like 'CatLinks.CategoryID' as a tag as it has a period in it. Best thing to do would be to use a global tag to set it to something else, i.e.:

modify_set_id =>
Code:
sub { my $tags = shift; return { CatID => $tags->{CatLinks.CategoryID} }; }
Then put:

<%modify_set_id%>

and your category id is now in <%CatID%> which will work fine.

Also, you want to use ==, not like in your tests.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Multiple Category Modify In reply to
Hi Alex,

I still can't seem to get this work. I put in the modify_set_id global as you noted, but I'm not sure how/where to put this on the template. Whenever I put it (<%modify_set_id%>)on the modify.html template I get an error. (Unable to compile 'modify_set_id'.)

Basically, I just want the check box to be checked on the modify form if the user's link is in the category. I was trying the following with the global installed:

<input type="checkbox"
name="<%CatID%>" value="25"
<%if CatID == '25'%>checked<%endif%>>

That didn't work, though. It didn't show it as checked on the modify form even if the links was in the category with the ID number 25.

I suppose I'm missing something obvious here. If anyone has any ideas it would be great appreciated!

-jw