Skip to main content
Known Participant
December 2, 2007
Question

Drop-down menu influenced by another menu

  • December 2, 2007
  • 6 replies
  • 770 views
I want to have two drop-down menus on my website's homepage. Users select a State (Alabama, Alaska, etc.) from one menu, which then automatically determines what's in the next menu--cities within that state. Cities will be supplied using a MySQL table on the server.

So...how do I do it???
This topic has been closed for replies.

6 replies

Inspiring
December 5, 2007
Gabe the Animator wrote:
> Well, I did what I think you wrote, but when I preview the page in my web browser (after uploading to the testing server), each drop-down menu says {name} . What am I doing wrong?

Have you uploaded xpath.js and SpryData.js?

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Known Participant
December 5, 2007
Well, I did what I think you wrote, but when I preview the page in my web browser (after uploading to the testing server), each drop-down menu says {name} . What am I doing wrong?
Inspiring
December 3, 2007
Gabe the Animator wrote:
> How do I get it so
> it starts working like the sample? How do I link the XML to the Spry Datasets,
> etc.???

That's why I asked how familiar you are with XML and Spry. The Framework
that you have downloaded contains all the documentation (double-click
Readme.html in the top-level folder). You can access the example I
showed you online by loading samples/index.html, and clicking the Data
Set Master/Detail link on the Spry Data and Dynamic Region tab.

You can set up the first data set (for the states) in Dreamweaver CS3 by
clicking the Spry Data Set button on the Spry Insert bar, and navigating
to states.xml. Click Get schema, and select state as the Row element.
Set up the second data set (for the cities) by choosing one of the
individual states, and selecting city as the Row element. That will
attach the correct JavaScript files to your page, as well as creating
the basic Spry data sets. You then need to start digging in the code to
amend it, changing the name of the XML file that you chose for the
second data set to {dsStates::url}, and adding the Spry regions in the
body of the page.

Spry results in very little markup, but understanding how that markup
works involves a lot more work. The Spry documentation is very
extensive, and requires careful study. (I've barely begun to scratch the
surface of it myself.) You can also get help in the dedicated Spry
forum, where several members of the Spry development team are actively
involved in helping solve problems:

http://www.adobe.com/go/labs_spry_pr1_forum


--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Known Participant
December 3, 2007
OK, so I've downloaded the "framework", and the only think that looks similar to the XML dataset that I need is in the folder "data" > "states". But in the states folder is every single state from Alabama to Wyoming. How do I get it so it starts working like the sample? How do I link the XML to the Spry Datasets, etc.???
Known Participant
December 3, 2007
anybody?
Inspiring
December 2, 2007
Gabe the Animator wrote:
> I want to have two drop-down menus on my website's homepage. Users select a
> State (Alabama, Alaska, etc.) from one menu, which then automatically
> determines what's in the next menu--cities within that state. Cities will be
> supplied using a MySQL table on the server.

How familiar are you with XML and Spry? The following page does exactly
what you want:

http://labs.adobe.com/technologies/spry/samples/data_region/DataSetMasterDetailSample.html

To find out how it works, view the source code in your browser.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
December 2, 2007
Gabe the Animator wrote:
> I don't know what "the value of the url column, in the currently selected row,
> of the dsStates data set, as the URL arg to the constructor for the dsCities
> data set" means. I've got an XML dataset linked to a Spry repeat region
> dropdown list working well for the states menu, but I don't know where to go
> from there.

I haven't studied it in detail myself, but the example on that page uses
static XML files for the names of the cities in each state. If you
download the Spry zip file from
http://labs.adobe.com/technologies/spry/, you'll find the XML files in
data/states. The URL argument is pointing to those static files.

Since the names of the cities are unlikely to change very often, if at
all, it's probably more efficient to use static files, rather than query
a database each time.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Known Participant
December 2, 2007
Sorry, but I can't find the zip file. The link you provide just goes to the generic Spry home page. Anything more specific?