Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

double drop down - javascript

Status
Not open for further replies.

angeliamy

Programmer
Aug 28, 2003
16
US
I have a form that has an include in it that contains a double drop down that then populates three text boxes. The javascript that runs the drop down boxes consist of two forms to get them to work. Then the include and the rest of the data is surrounded by a form to input the data into a database. This works with one dropdown but when using a double the submit button won't work. The best way to show you what I mean is to view the website. If you want the code I can do that to. I'm stumped and can't figure out where to go. I thought you could have forms nested in forms but it just doesn't seem to work.

The page site address is:
Any help! Thanks!
 
Get rid of the second form altogether, you don't need it.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
What do you mean? The second form of the dropdown? I have to have the main form as this is what sends the data to the database.
 
Yes you need only one form that holds all of the elements in it - no need for a "form within a form" which browsers won't understand anyways...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
But each dropdown is a form and won't work without that setup. That is why I put it in a seperate file and did an include but it is still wrapped into the main form. It doesn't work if I take it out either. Do you know of a way to create a double dropdown without using forms?
 
angeliamy,

Your page has many unnecessary things - multiple HEAD, TITLE, and BODY tags for one. Perhaps there is an INCLUDE going on here, I can't be sure. Your javascript is written in the middle of the form which is just bad form [wink]. I am sure that the code can be altered to work with just one form as there is no need for more than that in this (and just about any other) situation.

It will take a little time to decipher, but I will take a look and see if I can post a solution based on your current code.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
This is an include, I stated that in the first thread. The Javascript isn't in the middle it's in the include file. When you view source on a page that has an include it puts it where the include is located. I don't know how you would have only one form when each process of the dropdown requires a seperate form to work. But if you can come up with another solution I would welcome it!

 
angeliamy -

Both FORM tags have [blue]ACTION=""[/blue] (which doesn't tell them what to do) and [blue]ONSUBMIT="return false"[/blue] (which will always prevent them from being submitted)

The second FORM tag has no closing tag

I'm guessing that when it's all done, you will still have a problem with getting the top form's data submitted - but we'll cross that bridge when we come to it.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top