Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Cascading Select based on Category

Quote Reply
Cascading Select based on Category
Anyone have ideas on how to populate a second select based on the auto generated category select list (Links 3.x) in the add.cgi for a dynamic site?

I've looked at XML and javascript solutions, but trying to merge any of that into the include_form template just about made my head explode. Incidentally, there were a couple of old threads related to this (I think I searched 'dependent select') in the DBMan forum. Don't know if that info can be put to use.

A programmer I am not.
Thanks!
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?
Quote Reply
Re: [kthull] Cascading Select based on Category In reply to
Hi,

I'm not 100% sure what your asking for. Are you trying to make a SELECT dropdown, listing the categories?

If so, you could use this free plugin I wrote: http://www.ultranerds.com/...s/ULTRAGlobals_L217/

This function should do what you want:

Load_Category_Dropdown

Example:

Code:
<%Plugins::ULTRAGlobals::Load_Category_Dropdown(0)%>

Its explained in more detail in the Readme Smile

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 | 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] Cascading Select based on Category In reply to
No, what I need is to have a second select list that is conditionally populated when the category select is chosen. Here's a link to the javascript version: http://www.sislands.com/...0/week5/onChange.htm. I was wondering if there was a way to do this within links.
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?
Quote Reply
Re: [kthull] Cascading Select based on Category In reply to
Hi,

Mmm.. thats not so easy :/

So what you want - is when someone selects a specific category - it then auto-populates a second SELECT box, with different options, per category?

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 | 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] Cascading Select based on Category In reply to
Exactly. I don't know if it helps any that the second SELECT is a static list of options so it wouldn't need to be in a table.
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?
Quote Reply
Re: [kthull] Cascading Select based on Category In reply to
Hi,

Mmm.. its still pretty hard to do :/

I'll see what I can come up with. Can't spend too long on it though, as it has the potential to use a couple of hours of my day :P

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 | 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] Cascading Select based on Category In reply to
I'll try the javascript route first. I think I can make sense of it. I was mainly wondering if this was something that would be doable through Links itself.

Thanks!
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?
Quote Reply
Re: [kthull] Cascading Select based on Category In reply to
Hi,

The problem I think you're going to have, is the value="" bit on the category dropdown.

i.e the value for a test category may be "5" (i.e CatID 5) ... so the page you gave gives errors - because it would require the array var to be called "var 5" - which is an invalid name, cos of being a number.

If you could somehow get it so that it lets you name the var's cat5, cat10, etc ... then you may be able to get it to work.

I've given it half an hour trying to get it working, but can't spend any more time on it.

Hopefully the things I've found out help you a bit :)

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 | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [kthull] Cascading Select based on Category In reply to
Hi Kevin:

I don't know whether this will be any use to you, but have a look at this site:-

http://www.pengoworks.com/...fm?action=get:qforms

I used this API for my add form sometime ago and was able to populate things using Links tags/globals etc. It's fairly advanced (for me anyway), but is very powerful.

Hope this is of some help,


Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Andy] Cascading Select based on Category In reply to
Thought I'd post a follow-up.

I worked up a rough solution to the issue Andy raised about the category SELECT based on numbers rather than text. I built in a series of if/then statements to return the proper array based on the numeric categories. Incidentally, using the switch(n) function which would have made it a better solution, but I was having trouble getting that to work and ultimately scrapped that whole script for an even better solution, here: http://www.litotes.demon.co.uk/...ependent_select.html.

What I like about this route is that it is non-Javascript friendly, whereas the original solution wasn't. Not too sure about the suggested qForms API...took a look and that was way over my head.

At any rate, I learned a whole lot about Javascript so the time spent on the ditched solution wasn't a total loss.

Thanks!
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?