View Full Version : Dynamic Forms...

09-07-2006, 08:17 PM
Hello, I'm trying to create a script that will eventually give a price quote on a products.

The thing I'm trying to do with Javascript is make a field appear if a specific option is selected in a dropdown box..

Kinda like this:

Print locations (1 or 2, dropdown box)

[If 2 is selected, a new dropdown box will appear here]

Anyone able to point me in the right direction? I'm a huge Javascript n00b.

09-07-2006, 10:26 PM
Add an onchange handler to the dropdown and call a funciton in that function you need to do something like this:

var sel = document.forms[0].selectName1;
if(sel.options[sel.selectedIndex].value == 1){
document.getElementById("someDivId1").style.display = "block";
document.getElementById("someDivId2").style.display = "none";
document.getElementById("someDivId2").style.display = "block";
document.getElementById("someDivId1").style.display = "none";