Copied to clipboard

Flag this post as spam?

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


  • Craig O'Mahony 364 posts 918 karma points
    Jan 16, 2014 @ 14:29
    Craig O'Mahony
    0

    umbraco.library:GetPreValueAsString({0}) Not working

    Hi,

    I've set up a radio button list on a document type that allows users to select from this list when they're creating content. What i'm trying to do is display what they've selected so in the Template I've entered.

    <umbraco:Item field="templateType" runat="server" />

    But this only displays the ID of the item in the radiobutton list but I'd like to display the actual text of the radiobutton option. So after searching the forums I've changed my code to this. But this doesn't actually display anything.

    <umbraco:Item runat="server" field="templateType" xslt="umbraco.library:GetPreValueAsString({0})" />

    Can anyone shed any light please?

    Thanks,
    Craig

     

     

     

     

     

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 16, 2014 @ 23:23
    Dennis Aaen
    0

    Hi Craig,

    I have no problems getting the actual text of the radiobutton option to display, by usig this code:

    <umbraco:Item runat="server" field="templateType" xslt="umbraco.library:GetPreValueAsString({0})"/>

    So on the frontend I get Option 1 outputted.

    I am using Umbraco 6.1.6 running on a SQLCE database. If you could provide more infomation about which version of Umbraco that you´re running, then I will try to see, if I can reproduce the same as you.

    /Dennis

  • Craig O'Mahony 364 posts 918 karma points
    Jan 17, 2014 @ 10:43
    Craig O'Mahony
    0

    Hi Dennis,

    Thanks for the response. The install that I'm running is 4.9.1 with a SQL backend.

     

     

    This looks more or less identical to what you've got, but nothing gets displayed.

    Thanks for your time.

    Craig

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 17, 2014 @ 11:32
    Dennis Aaen
    100

    Hi Craig,

    I have just tried to setup the same setup as you, and I can confirm it´s only displays the ID when you are using

    <umbraco:Itemfield="templateType"runat="server"/>

    And nothing if you´re using the inline xslt version:

    <umbraco:Item runat="server" field="templateType" xslt="umbraco.library:GetPreValueAsString({0})" />

    I think there might be a bug in version 4,9,1 on the Radio button list and it´s prevalue. If you need it you could upgrade your Umbraco installation if possible, if an upgrade isn't possible a workaround be using a Checkbox list instead of the Radio button list.

    You can pull out data like:

    <umbraco:Item field="templateType" runat="server" />

    or

    <xsl:value-of select="$currentPage/templateType" />

    By change it to a checbox list I have not managed to get inline XSLT to work, but you can make an XSLT file an place it´s macro where the value should apear or you can pull out the data by just using the <umbraco:Item> as I show above.

    Hope this can help you.

    /Dennis

  • Craig O'Mahony 364 posts 918 karma points
    Jan 20, 2014 @ 10:38
    Craig O'Mahony
    0

    Hi Dennis,

    Just to let you know that changing the selector to a dropdown list solved the problem as you thought it might :)

    Thanks for your time and help....top man.

    Craig

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 20, 2014 @ 11:05
    Dennis Aaen
    0

    Hi Craig,

    Good to hear. I´m glad that I could help you.

    I think that you should mark this topic as solved, so other searching for the same issue can see what worked for you.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft