cah1011@hotmail .com (Chris Healy) emerged reluctantly from the
curtain and staggered drunkenly up to the mic. In a cracked and
slurred voice he muttered:
[color=blue]
> I have 2 drop down boxes on my site. I want the selection of the
> first one to populate the second box. Any suggestions are
> appreciated.[/color]
"Chris Healy" <cah1011@hotmai l.com> wrote in message
news:3541f1a0.0 407210803.3be30 f5d@posting.goo gle.com...[color=blue]
> I have 2 drop down boxes on my site. I want the selection of the
> first one to populate the second box. Any suggestions are
> appreciated.[/color]
I don't know how au fait you are with Javascript and so on, but here's what
I've done in the past:
Option 1:
=============== ======
If its a small re-population, and all the possible types can be sent with
the page without affecting speed too much, you can stored a 2-dimensional
array as follows:
MenuChoices(Cho senIndexFromFir stMenu)(0 to n)
And then populate the array when the page is called. This would work such
that each first choice would have an index, and that would allow you to
select an array of options for the second menu.
Option 2
=============== ======
If the total number of choices is very large, I have used a hidden IFrame in
the page to request the choices for the second menu, and then load them in
when they are returned by the server. This would require a script on the
server to receive the chosen item from the first menu, and then pass back
the relevant contents for the second one.
If you want to know more about one of these option you're welcome to e-mail
me. The first option is also very common on the web, if you do a google
search.
Chris Healy wrote:
[color=blue]
> I have 2 drop down boxes on my site. I want the selection of the
> first one to populate the second box. Any suggestions are
> appreciated.[/color]
If you're looking for a PHP solution, then you'll need to submit a form
and reload the page each time a change is made. It's not good for strain
the server. PHP isn't the ideal solution for this.
On the other hand, Javascript is great for it. The best solution is
using a two dimensional array.
"neur0mania k" <usenet@neur0ma niak.co.uk> wrote in message
news:40fea261$0 $44452$ed2619ec @ptn-nntp-reader02.plus.n et...[color=blue]
> Chris Healy wrote:
>[color=green]
> > I have 2 drop down boxes on my site. I want the selection of the
> > first one to populate the second box. Any suggestions are
> > appreciated.[/color]
>
> If you're looking for a PHP solution, then you'll need to submit a form
> and reload the page each time a change is made. It's not good for strain
> the server. PHP isn't the ideal solution for this.
>
> On the other hand, Javascript is great for it. The best solution is
> using a two dimensional array.[/color]
You don't need to reload the page, you just need to request the new menu
items from the server, and load them in dynamically with JavaScript...
You can implement this (as we did) using an IFrame and some javascript, or,
for example an XML object in JS can also retrieve HTTP data.
Comment