Skip navigation
sebutler93
Currently Being Moderated

Dependent dropdown lists in dreamweaver

May 1, 2012 11:48 PM

Tags: #cs5 #help #html #dreamweaver #code #list #drop_down_list #dynamic_list #dynamic_drop_down_list #dependent_drop_down_list

I've been trying to figure this out for hours... im completely new to all this and i have dreamweaver cs5 and microsoft excel.. i dont want to use javascript if that is possible to avoid!! i want it to be something like what is seen in http://labs.adobe.com/technologies/spry/samples/data_region/DataSetMas terDetailSample.html except i have to make it with counties in michigan instead of the state list and the second list would be cities within that specific county that the user selected... please try to explain it as simple as possible!! Thanks

 
Replies
  • Currently Being Moderated
    May 2, 2012 12:30 AM   in reply to sebutler93

    Markup by itself will not solve your problem. You will need a scripting language like JavaScript, PHP, Coldfusion or one of the Microsoft languages.

     

    Once you have made up your mind to start using JavaScript, the example that you have quoted is one of the best ways to go.

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2012 4:15 PM   in reply to sebutler93

    I have translated the above into a Spry application. There is 1 HTML document and 4 XML documents namely:

    1. sample.html
    2. categories.xml
    3. homeware.xml
    4. education.xml
    5. books.xml

     

    The latter 4 can be viewed as a (flat filed) database.

     

    The markup for sample.html:

     

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <script src="http://labs.adobe.com/technologies/spry/includes_minified/xpath.js"></script>
    <script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryData.js"></script>
    <script>
    var dsCategories = new Spry.Data.XMLDataSet("categories.xml", "categories/category");
    var dsSubCategories = new Spry.Data.XMLDataSet("{dsCategories::url}", "category/subcategories/subcategory");
    </script>
    </head>
    
    <body>
    <form name="selectForm" action="">
        Category:
        <span spry:region="dsCategories" id="categorySelector">
            <select spry:repeatchildren="dsCategories" name="categorySelect" onchange="document.forms[0].subcategorySelect.disabled = true; dsCategories.setCurrentRowNumber(this.selectedIndex);">
                <option spry:if="{ds_RowNumber} == {ds_CurrentRowNumber}" value="{name}" selected="selected">{name}</option>
                <option spry:if="{ds_RowNumber} != {ds_CurrentRowNumber}" value="{name}">{name}</option>
            </select>
        </span>
        Subcategory:
        <span spry:region="dsSubCategories" id="subcategorySelector">
            <select spry:repeatchildren="dsSubCategories" id="subcategorySelect" name="subcategorySelect">
                <option spry:if="{ds_RowNumber} == {ds_CurrentRowNumber}" value="{name}" selected="selected">{name}</option>
                <option spry:if="{ds_RowNumber} != {ds_CurrentRowNumber}" value="{name}">{name}</option>
            </select>
        </span>
    </form>
    </body>
    </html>

     

    The contents for categories.xml:

     

    <?xml version="1.0" encoding="utf-8"?>
    <categories>
        <category>
            <name>Home Ware</name>
            <url>homeware.xml</url>
        </category>
        <category>
            <name>Education</name>
            <url>education.xml</url>
        </category>
        <category>
            <name>Books</name>
            <url>books.xml</url>
        </category>
    </categories>
    

     

    The contents for homeware.xml:

     

    <?xml version="1.0" encoding="utf-8"?>
    <category>
        <name>Home Ware</name>
        <subcategories>
            <subcategory>
                <name>Air-Conditioners/Coolers</name>
            </subcategory>
            <subcategory>
                <name>Audio/Video</name>
            </subcategory>    
            <subcategory>
                <name>Beddings</name>
            </subcategory>    
            <subcategory>
                <name>Camera</name>
            </subcategory>    
            <subcategory>
                <name>Cell Phones</name>
            </subcategory>
        </subcategories>
    </category>
    

     

    The contents for education.xml:

     

    <?xml version="1.0" encoding="utf-8"?>
    <category>
        <name>Education</name>
        <subcategories>
            <subcategory>
                <name>Colleges</name>
            </subcategory>
            <subcategory>
                <name>Institutes</name>
            </subcategory>    
            <subcategory>
                <name>Schools</name>
            </subcategory>    
            <subcategory>
                <name>Tuitions</name>
            </subcategory>    
            <subcategory>
                <name>Universities</name>
            </subcategory>
        </subcategories>
    </category>
    

     

    The contents for books.xml:

     

    <?xml version="1.0" encoding="utf-8"?>
    <category>
        <name>Books</name>
        <subcategories>
            <subcategory>
                <name>College Books</name>
            </subcategory>
            <subcategory>
                <name>Engineering</name>
            </subcategory>    
            <subcategory>
                <name>Magazines</name>
            </subcategory>    
            <subcategory>
                <name>Medicine</name>
            </subcategory>    
            <subcategory>
                <name>References</name>
            </subcategory>
        </subcategories>
    </category>
    

     

    All you need to do is place 5 new documents in the same folder/directory with the suggested names and copy and paste the above code into each related file. Then view in your favourite browser.

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2012 7:35 PM   in reply to sebutler93

    Barring any typo's it should work wherever. Have a look here http://pleysier.com.au/butler/

     

    Once on the page, right click the page and click View Source or similar to see the source code.

     

    Gramps

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points