Dynamic dropdown without changing context

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
PhpDog
Forum Commoner
Posts: 58
Joined: Mon Jan 14, 2008 10:23 am

Dynamic dropdown without changing context

Post by PhpDog »

I have two html dropdown controls on an php intranet project. How can I get the second one to change when the user makes a new selection from the first one without changing the current screen context please?

For example, the first select list is, say,

short box
long box
big box
small box

and the second select list for the first item (short box - the default) is

red
blue
green

but by selecting 'long box' from the first select list the second select list is now

black
purple
yellow
orange

without the rest of the screen changing.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Dynamic dropdown without changing context

Post by RobertGonzalez »

This would be done client side, with Javascript. I am drawing a complete blank on the name of the process you are asking about, but essentially you are using the selected index of one form element to control the content of another form element.
devendra-m
Forum Contributor
Posts: 111
Joined: Wed Sep 12, 2007 3:16 am

Re: Dynamic dropdown without changing context

Post by devendra-m »

refer http://www.hotandco.com

when you select netherlands in country field , city field will be loaded with cities in netherlands. You need ajax for that.
PhpDog
Forum Commoner
Posts: 58
Joined: Mon Jan 14, 2008 10:23 am

Re: Dynamic dropdown without changing context

Post by PhpDog »

Many thanks fo the replies.

I have solved the problem by using dynamic php to create Javascript menus on the fly from the SQL Server 2005 database.
Works nicely. :)
Post Reply