Copied to clipboard

Flag this post as spam?

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


  • Xaiou 6 posts 26 karma points
    Oct 26, 2009 @ 21:13
    Xaiou
    0

    How do I get the Text from a dropdown?

    Hi,

    I am using Umbraco 4.  I want to setup a "State" dropdown, so users can create a new page and select their State (AL, AK, AZ, etc).  So I followed this procedure:

    1. Go to the developer section.
    2. Right click on data types and choose "create"
    3. Give a name to your new data type - states
    4. Find it in the data types.
    5. Change its rendercontrol to "dropdown list" and click on the save button (I also tried "dropdown list, publishing keys")
    6. Selected Database Datatype as "NText", and added a few state codes.

    7. Saved, added this dropdown list to my document type, then inserted it into the template as a "  <umbraco:Item field="states" runat="server"></umbraco:Item>"

    8. Created a new Content page, selected the appropriate State, and published.

    At this point, I expect to see the Text for the dropdown on the page, but instead, I see the Value (a number).  I tried to add some inline XSLT to pick out the Text, but nothing worked. 

    How do I get the Text out and onto the page, instead of the Value?  I hope you can help me,

       - Karen from Santa Barbara

  • skiltz 501 posts 701 karma points
    Oct 26, 2009 @ 21:45
    skiltz
    0

    You should be able to create an xslt file and do:

    <xsl:value-of select="string($currentPage/data [@alias = 'states'])"/>

    BTW I just came back from a wedding in SB such a awesome, beautiful place.

     

  • Xaiou 6 posts 26 karma points
    Oct 27, 2009 @ 19:30
    Xaiou
    0

    OK, I think I have this figured out.  No XSL is required at all.  Following the procedure from my original post,

    1. If I click on the "Preview" icon in the Content manager (next to the "Save and Publish") icon, then I get a page, and it shows State=5 (the ID, not the text value).  This is how I had been viewing the pages.

    2. However, if I click on the link to the page "Link to document: states.aspx", from the Properties tab in the Content section, then it shows State=AK (the text, not the ID).

    So there is a difference between the "Preview" icon, and the link to the ASPX file???  I've lost several hours on this - is this the way Umbraco 4 is supposed to behave?

    Also, I love New Zealand!  I spent a few weeks in Nelson, on the South Island.

Please Sign in or register to post replies

Write your reply to:

Draft