Gossamer Forum
Home : Products : DBMan : Installation :

Is this possible...?

Quote Reply
Is this possible...?
Hello there,

Is it possible to do the following...

I have 2 different fields that I populate using the "build_select_field" sub. I want the second field to be dependent on the selection of the first one so that only the relevant options will show on the selection box.

just as an example...

type1 => 'Cars,Motorcycles'
type2 => 'BMW,MERCEDES,FORD'
type3 => 'KAWASAKY,SUZUKY,HONDA'

My first field would display the type1 options.
My second field would display either type2 or type3 options depending on what was selected in the first field (or a default with all type2 and type3 if the first field has not been selected).

So far I have an extended "build_select_field" sub that allows me to pass which type to display.

build_select_field_ext ("Status", "$rec{'Status'}","type1");

The problem with this is that it is all static unless I can put some sort of runtime conditional build_select_field that gets build depending on the value of the first field.

Is that possible?

Thanks

-JO
Quote Reply
Re: Is this possible...? In reply to
I've seen this done on a Microsoft site, uses some Javascript I believe.

If you track down the code, wouldn't be too hard to insert into DBMan I believe.

Cheers,

Alex
Quote Reply
Re: Is this possible...? In reply to
Hi Alex,

Thanks for responding...

I tried looking for something similar in the microsoft site but I could not find it.

Anyway, I have tried using something like

if ($in{'type1'} eq "Cars" ) {...}

in the html_record_form, but it does not work because $in{'type1'} does not contain the selection from the build_select_field sub. Is there a way I can get back the value of that selection?

Thanks
-JO
Quote Reply
Re: Is this possible...? In reply to
They use that kind of thing on Carpoint to select different models of cars. http://www.carpoint.msn.com

Hope that's what your looking for.


------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Is this possible...? In reply to
I dont know if this is a bit old.. but in webreference.com you have that script along with an explanation on how to set it up, etc.

It was on the homepage (AFAIK) but if you cant find it there go to javascript section (its made with javascript).

hope it helps, good luck.
Quote Reply
Re: Is this possible...? In reply to
Hello Ron,

Nope, it is not late. That is exactly what I was looking for. I will post my mods once it is done (I am being pretty optimistic here...).

Thanks
-JO

PS: Jason, Carpoint has it too but a refresh is needed every time a new selection is made (slowing things down and putting an extra load to the server). With this java script, the server is only hit with the submit.