Gossamer Forum
Home : Products : DBMan : Customization :

Double selection box?

Quote Reply
Double selection box?
I am sorry if this has been asked before, but I went through many many posts and didn't see anything on it.

Is it possible to have one field with two separate selection boxes? Such as Location [Select Country] [Select State]? Or even better yet, have it so that the second field is dependent on the first field (you only select a state is country is United States, otherwise you do not see that option)?

Thanks!

Quote Reply
Re: Double selection box? In reply to
For option 1 see this post:
http://webmagic.hypermart.net/dbman/fields3.htm#9

For option 2 you'd need to ask the person his/her country, save that info (or pass it along in the url), and then generate some kind of if/then statement like:

if ($rec{'country'} eq "USA") {print qq| <INPUT... NAME="$rec{'state'}"> |;}


(or use $in{'country'} if passing it along)

You don't really need an "else" but you could add one if you wanted to print some alternate text or blank spot for formatting purposes (there is even a shorter way to do the above code, perhaps someone would be kind enough to post it).

If you wanted to do option 2 "on the fly" you'd probably need to use something like JavaScript. Go to: http://javascript.internet.com and look under "forms" - I am almost positive they have a script that will generate an input box dynamically based on the answer of another input box and then you could use the examples on the FAQ page to add the two fields together.

For the sake of simplicity option 1 may be your best bet.

Good luck - Mike.

Quote Reply
Re: Double selection box? In reply to
try this javascript from wsabstract. I use it in my dbman. Works great.

http://www.wsabstract.com/script/cut183.shtml

Trev