Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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.
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.
also heres the reference to those two Library Methods.
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.
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.
Very useful advice Peter Gregory with Split function - exactly what I was looking for! Thanks
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted