Forums

This topic is locked

Dynamically Populate a Dropdown

Posted 09 Nov 2002 15:49:27
1
has voted
09 Nov 2002 15:49:27 Fayaz Khaki posted:
I am trying to do something very, very basic. I would like to have one
dropdown box control the values in the other. For example, I have a
database that contains all the valid bank routing numbers in the US for each
state. I have to be able to select a "State" code in the first dropdown
box, and consequently, show only the bank names for the selected "State" in
the second dropdown.

How can this be done?? I tried making 2 record sources, but how do I
control the bank name list record set with the value from the 1st recordset
(containing just the "State" Codes)??

NB: I am using DWMX.



Replies

Replied 09 Nov 2002 22:08:23
09 Nov 2002 22:08:23 Dennis van Galen replied:
It would help if we knew what language you use...
Anyway, try this for asp/vb and asp/Jscript:
www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listbox.htm

For your ColdFusion pleasure:
www.webtricks.com/sourcecode/code.cfm?CodeID=18

Can't seem to find .NET solution and for PHP I don't have a clue.

Happy coding <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

With kind regards,

Dennis van Galen
Webmaster KPN Services
Financial and Information Services
Replied 11 Nov 2002 12:17:48
11 Nov 2002 12:17:48 Fayaz Khaki replied:
Thanks for that Dennis, it works fine....but now I can't get the results page to populate with any results!! When I switch back to using static dropdowns it works fine but not after I have entered the javascript.

I am not a programmer so I tend to relay on the GUI in DWMX. Any ideas as to why my results page isn't showing any results found (when I know there are).

Regards

Fayaz Khaki
Replied 11 Nov 2002 18:27:03
11 Nov 2002 18:27:03 Dennis van Galen replied:
That's strange, it should work fine...

Are you using the POST method in your form ?
Then your detail page query needs to filter on the form data.

If you are using the GET method then you need to filter on a URL parameter.

Or in macromedia's words:

The GET and POST methods offer different ways to send form data to the server. If you choose the POST method, the search parameters are sent in the body of the message. If you choose the GET method, the parameters are appended to the page's URL as a query string.

If you plan to use record navigation server behaviors on your results page (for example, if you plan to display multiple pages of results), choose the GET method. This ensures your results page is compatible with the search page and the record navigation server behaviors, both of which rely on URL query strings to function properly.

here's a simple search tutorial that explains the post and get methods alittle more:
www.macromedia.com/support/ultradev/building/simple_search_feature/
This shows you how to filter on URL parameter:
www.macromedia.com/support/ultradev/ts/documents/search_results.htm
The form method works almost the same, you select FORM and type the element name into the GUI <img src=../images/mxzone/forum/icon_smile.gif border=0 align=middle>

I hope that helps you further, if not don't be afraid to ask.

With kind regards,

Dennis van Galen
Webmaster KPN Services
Financial and Information Services
Replied 12 Nov 2002 12:59:47
12 Nov 2002 12:59:47 Fayaz Khaki replied:
Thanks for help Dennis, after messing around for a few hours trying to get to work I got fed up and decided to rebuild the search page step by step and it works!!!

I guess I must have forgotten to change somthing back when I was figuring out how to have the dropdowns dynamic....

Anyway thanks for all your help.

Regards

Fayaz

Reply to this topic