Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 08:16
    Fuji Kusaka
    0

    Drop Down List

    Hi guys,

     

    I made an XSLT from changeable source and thus want to pull data from a node but i would like to use a drop down list to that user can choose what they want to view lets say " Categories".

    My question is how to i get to populate the data ins a drop down list.

     

    Fuji

  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 08:34
    Eran Meir
    0

    are you talking about the backend or frontend?

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 08:35
    Fuji Kusaka
    0

    Frontend.....i want to be able to populate the list on my website in a drop down list.

  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 08:41
    Eran Meir
    0

    so you want the user to select a category from a list of categories ? correct me if i'm wrong.

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 08:42
    Fuji Kusaka
    0

    Correct....

  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 08:54
    Eran Meir
    0

    ok so lets say you are in the page of "categories" and all your child nodes are categories

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

    is that anwser your question?

  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 08:55
    Eran Meir
    0

    forgot to mention one thing

    <option value="{@id}"><xsl:value-of select="@nodeName" /></option>

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 09:39
    Fuji Kusaka
    0

    I gave this a shot

     

    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
     
        <option value="{@id}"><xsl:value-of select="@nodeName"/> </option>
     
    </xsl:for-each>

     

    The drop down is populating the content as well


  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 09:40
    Eran Meir
    0

    great :)

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 09:43
    Fuji Kusaka
    0

     

    Can i ask you why you used this code though??

     

        <xsl:for-each select="$currentPage/Category">
            <option value="{@id}"><xsl:value-of select="@nodeName" /></option>
        </xsl:for-each>
  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 09:48
    Eran Meir
    0

    sure you can,
    lets say this is your website

    Root
         Home
               Categories
                      Category 1
                      Category 2
                      Category 3

    you are currently on the page of http://nameofwebserver.com/Categories/

    the currentPage variable points to "Categories" page
    you can use the currentPage variable to populate all the children of "Categories"

    if you are on the page http://nameofwebserver.com/
    the currentPage variable will point to "Home" node.

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 09:57
    Fuji Kusaka
    0

    Makes sense, thanks Eran

  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 10:04
    Eran Meir
    0

    one more important thing to mention
    the http:///nameofserver.com points to "Home" node because its the first node.

    if you have

    Root
       Home
          Categories
       Home2
          Categories

    the home2 link will be http://www.nameofserver.com/Home2

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies