Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Stealth on September 25, 2006, 08:25:19 am

Title: programming help
Post by: Stealth on September 25, 2006, 08:25:19 am
Hey,

I've got a friend that needs to do this, was wondering if anyone had any ideas:

Say he's got a form.  10 fields.  The first field is a dropdown with various companies.  If the user selects company A in dropdownA, then dropdownB will display options 1, 2, and 3.  If the user selects company B in dropdownA, then dropdownB will display options 4, 5, and 6. 

How would he do that? 
Title: Re: programming help
Post by: Shade on September 25, 2006, 09:24:55 am
What programming language? If c/c++, it sounds like a job for a switch/case statement, but from what you describe I imagine it's visual basic or some such, which I have no experience with.
Title: Re: programming help
Post by: Stealth on September 25, 2006, 09:28:48 am
oh no it's going to have to be PHP or javascript.  some sort of web language
Title: Re: programming help
Post by: Shade on September 25, 2006, 09:56:43 am
Ah, that I can do. I assume you want to avoid page loads after selection? That means javascript. I'm too lazy to explain it, so I'll just drop you a Helpful Link (http://javascript.internet.com/navigation/connected-dropdown-box.html).
Title: Re: programming help
Post by: Stealth on September 25, 2006, 11:50:40 am
great. thanks :)
Title: Re: programming help
Post by: Ashrak on September 25, 2006, 12:16:06 pm
with php you need to make only 1 dropdown when u submit then a second appears etc in steps
Title: Re: programming help
Post by: Descenterace on September 25, 2006, 01:08:30 pm
Which is why it's really a job for Javascript and AJAX. Assuming the second dropdown's contents are fixed for each selection on the first, you can load everything into the page and do it all clientside. If you don't want a page to load but the second dropdown has to be prepared serverside, you send an AJAX request and use the result to populate the second dropdown.

But that's overly complicated, and I've only been using JS for a few months, and I have an understandnig with AJAX: I don't touch it, and it doesn't chew my limbs off and beat me to death with them.