Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amanda Atchley 2 posts 20 karma points
    Jul 06, 2009 @ 22:53
    Amanda Atchley
    0

    Cascading Drop Down - Documents - Complete Brain Block

    I don't know why I can't seem to grasp this.  It is driving me absolutely nuts.  I'm sure its something so simple its rediculous. 

     

    But I'm having one of those moments where you could ask my my name and I'd freeze.

     

    I'm trying to build casecading dropdowns

     

    The first drop down would be all sub-nodes of X

    The second would be All Related Documents of item selected in 1st drop down.

     

    I can query them separately fine.  I'm getting stuck on the ajax-y part.

     

    The second dropdown needs to be Related from a Changeable Source - right?

    BIG QUESTIONS

    - Can I do this in one XSLT doc?

    - If so... how do I code the second drop?

    -If not in one XSLT - throw your best idea at me

  • Daniel.S 50 posts 135 karma points
    Jul 07, 2009 @ 00:26
    Daniel.S
    0

    Probably better off putting something like this into a usercontrol.

  • Jesper Ordrup 975 posts 1411 karma points MVP
    Jul 07, 2009 @ 01:47
    Jesper Ordrup
    0

    Hi Amanda,

    Sure it can be done in xslt. That's how all (most) Umbraco navigation is done. Could you give us an example of what you're trying to do?

    /Jesper

     

  • bob baty-barr 1179 posts 1292 karma points MVP
    Jul 07, 2009 @ 02:16
    bob baty-barr
    0

    i am thinking you would have to use a combination of xslt and jquery to change the source of the second <select></select> are you talking about dropdown menus or a navigation that has flyouts?

    you can check out http://packages.maliciousthinktank.com and take a look at the mtt_ultimate nav, Dirk helped me out with it big-time, but he lets me distribute it as a jquery based horizontal navBar package.

    let us know if we can help.

  • Amanda Atchley 2 posts 20 karma points
    Jul 07, 2009 @ 03:16
    Amanda Atchley
    0

    I THINK I could be onto something.  Must have coffee!!  So I'm going to post this up while I walk down to the shop in case anyone wants to comment on the direction I'm going. 

    Something similar to script I found on the old forum in my header for catching the value of the 1st drop link to old post - problem being the original poster said it didnt work...and its for dealing with usercontrols not xslt/html items

    <script runat="server">
            public string setSource;

            protected void Page_Load(object sender, EventArgs e)
            {
                if (Page.IsPostBack)
                {
                    setSource = this.StateDropDownList.SelectedValue;
                }
                else
                {
                    if (setSource != null)
                        this.StateDropDownList.SelectedValue = "1115";
                }

            }
            public object value
            {
                get
                {
                    return setSource;
                }
                set
                {
                    setSource = value.ToString();
                }
            }

    </script>

     

    This is the main part of my xslt file---

    <xsl:variable name="dropOneSource" select="/macro/source1"/>
    <xsl:variable name="dropTwoSource" select="/macro/source2"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <div class="relatedParts">
    <select>
    <xsl:for-each select="umbraco.library:GetXmlNodeById($dropOneSource)/node [@nodeTypeAlias = 'Container']">
        <option value="{umbraco.library:NiceUrl(@id)}">

                <xsl:value-of select="@nodeName"/>
        </option>   
    </xsl:for-each>
    </select>


    <!-- Drop 2 These items are a list of items that are filtered determined on selection from Drop1 -->
    <select>
    <xsl:for-each select="umbraco.library:GetXmlNodeById($dropTwoSource)/node [@nodeTypeAlias = 'Container']">
        <option value="{umbraco.library:NiceUrl(@id)}">

                <xsl:value-of select="@nodeName"/>
        </option>   
    </xsl:for-each>
    </select>
    </div>
    </xsl:template>
  • bob baty-barr 1179 posts 1292 karma points MVP
    Jul 07, 2009 @ 06:04
    bob baty-barr
    0

    i think you can go the jquery route and xslt... but maybe that is overkill...

    http://www.ajaxray.com/blog/2007/11/08/jquery-controlled-dependent-or-cascading-select-list-2/

     

Please Sign in or register to post replies

Write your reply to:

Draft