Copied to clipboard

Flag this post as spam?

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


  • benji 2 posts 22 karma points
    Nov 09, 2010 @ 21:09
    benji
    0

    xslt if radiobuttons

    Hi I am new to umbraco
    I have a question. I have a Radiobox Datatype (Radiobutton list) with two values.
    (Text: Danish, Value: 73) and (Text: International, Value: 74)

    I would like to set up an if statement, which toggles between two images if you choose Danish (73) or International (74), but I can not figure out how. I think I've gone through most posts here.

    hope someone can help me.

    Benji.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 22, 2011 @ 12:21
    Kim Andersen
    1

    Hi there Benji.

    One way of doing this could be to create a xsl:choose like this:

    <xsl:choose>
    <xsl:when test="$currentPage/radioboxAlias='73'">
    image 1 here
    </xsl:when>
    <xsl:otherwise>
    image 2 here if the admin didn't choose the 'Danish'-option
    </xsl:otherwise>
    </xsl:choose>

    The above code will check to see if the Danish-option is selected. If that's not the case (if the International-option is selected, or none of them are selected), the image number 2 will be inserted.

    You could also create two xsl:if's instead, or change the xsl:otherwise to a xsl:when in the above code. There are a lot of different ways of doing this.

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft