Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

two combo boxes - can't clear second

onchange issue

2:27 am on Oct 12, 2007 (gmt 0)

New User

10+ Year Member

joined:Jan 13, 2007
posts: 27
votes: 0

Here's the run down:

first php page pulls values from mysql db for combo box # 1.
id name
1 car
2 truck
4 unicycle

- javascript processes the autotype_id through url to second php script

The output is sent to .innerHTML and creates combo box #1

A second php script pulls data for combo box # 2 based on the first combo box (second function).
id list autotype_id
1 pink car 1
2 blue car 1
3 pickup 2
4 bmw 3
5 clowns 4
- javascript processes the autos_id through url to a third php script

third php script pulls data detail for your select of the item from the second combo box.

The output is sent to .innerHTML and creates combo box #2

The page grows by your selections...

First comb box, then second, then details.

It works almost perfectly, when the second combo box changes, the details change with it. But when you change the first combo box, the details remain from the last choice. I wanted to find a way to run a command when the first combo box is changed that would reset the details either back to nothing and wait for you to select something on the second combo box again.

I tried concatenating a second command onto the first onchange, but it never worked.

I've searched the forums and found similar problems, but none that matched exactly.

Thank you all for your help in advance.


9:53 am on Oct 12, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 7, 2004
votes: 0



document.getElementById('sel_box_2').options.length = 0



Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members