Copied to clipboard

Flag this post as spam?

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


  • skiltz 501 posts 701 karma points
    Feb 08, 2010 @ 04:56
    skiltz
    0

    Retrieve Selected Values in Checkbox List + XSLT

    Confused: Is there XSLT syntax to pull out which items were checked?

    Datatype - Checkbox list attached to Member Profile

    If I look in ContentXML I see a list of ALL the checkbox items.  In cmsPropertyData I can see in here are the items that were selected ie 1157, 1158 etc. 

    <xsl:variable name="prefsToSplit" select="umbraco.library:GetCurrentMember()/data [@alias='SpecialtyWatch']"/> will give a list of all "SpecialtyWatch" items.

    Thanks in advance.

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Feb 08, 2010 @ 09:11
    Peter Gregory
    2

    Hi

    Have a look at the umbraco library functions split and getPreValueAsString

    Split will allow you split a comma seperated string like a list of prevalue ids and it will return a chunk of xml that represents the values.  You can then iterate through those ids and use GetPreValueAsString to get the text value.

     

    something like this

    <xsl:variable name="items" select="umbraco.library:Split($prefsToSplit,',')" />
    <xsl:for-each select="$items//value">
       <xsl:value-of select="umbraco.library:GetPreValueAsString(current())"/>
    </xsl:for-each>

     

    Hope that helps.


    Peter

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Feb 08, 2010 @ 09:13
  • skiltz 501 posts 701 karma points
    Feb 08, 2010 @ 21:02
    skiltz
    0

    Peter thanks heaps for your posts.  I am even more confused now....

    If I now do the following the "checked" items now display correctly.  I could have sworn I did the same yesterday and it was spitting out all the items not just the checked ones.  Anyhow seems to be working which is good.

    <xsl:for-each select="umbraco.library:GetCurrentMember()/data [@alias='SpecialtyWatch']">
    <xsl:value-of select="."/>
    </xsl:for-each>

     
    Thanks for your help.

  • skiltz 501 posts 701 karma points
    Feb 08, 2010 @ 21:14
    skiltz
    0

    Okay I found the issue.  If I save the checkbox from inside umbraco control panel it works as expected.  If I do it from the front end its saving correctly but its not republishing correctly so the changes are reflected client side.

    Thanks,
    Matthew

  • nickornotto 403 posts 907 karma points
    Sep 27, 2013 @ 12:35
    nickornotto
    0

    Very useful advice Peter Gregory with Split function - exactly what I was looking for! Thanks

  • 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