PDA

View Full Version : Form Help In Dreamweaver MX 2004?



Recognize
December 13th, 2005, 07:53 AM
Hi

Am trying to create a form where it gives a the user a choice of options which are in a List/Menu.

The problem is that depending on what option the user chooses from the 1st List/Menu it will change the all the options in the 2nd List/Menu.

Can anyone help how this can be done?

Am gonna be using PHP to code the form and if anyone could give a rough guide in the code then that would be great to.

Thanks in advanced :thumb2:

theflashdude
December 16th, 2005, 11:57 AM
Whats this actually for, if you can explain it a little more I might be able to help.

mpelland
December 16th, 2005, 12:06 PM
generally this would be done in javascript.

the way that I have done it in the past is by using javascript arrays

step 1) get all the data you want and organize it into arrays
step 2) populate the first list with the contents of the first array
step 3) call a JavaScript function when a new menu item is selected
step 4) have that function popular the second list using the another array (that array is selected based on the index of the first)

let me know if you need more specifics.. i will also try and find a couple examples

mpelland
December 16th, 2005, 12:07 PM
and there you have it... this page helped me when i was trying to figure this out a while ago
http://www.mattkruse.com/javascript/dynamicoptionlist/

playboyadonis
December 16th, 2005, 12:37 PM
If I were doing this, I would use asp or php (asp preferably to save programming time) I would try hard not to use JScript because some clients prefer not to have user's give permission and it looks like your page might be malicious to some folks.

Give your asp components unique ID names and use arrays to populate them. You will create a function that when called, analyzes the selectedValue or Item from ListA. You can use a nested If...If Else that looks like:

If (ListA.selectedItem == colors) then
listB = {red, green, blue}
Else If( ListA.selectedItem == numbers then
listB = {1,2,3}
Else If( ListA.selectedItem == fruit then
listB = {apple, orange, grapes}
End If

This code is not the correct syntax but it is the basic structure. Like anything else, there are a thousand and one different ways of doing things so, keep trying.

Other ideas include, populating the lists with database records, xml, or maybe this AJAX thing that everyone is moving toward.

Good Luck

mpelland
December 16th, 2005, 01:02 PM
yeah, either way (serverside or clientside) the methods are very similar. one requires a screen reload, the other doesn't...