DropdownlistMultiplePublishKeys editor returns prevalue text if only one item is selected
Hi There - I am trying to use the DropdownlistMultiplePublishKeys editor to categorize some nodes. Some nodes will have single categories while others may have multiple.
The issue that I'm having is that if there are multiple prevalues selected, the value of the property is a comma seperated list as I was expecting. For single selections however, the property returns the prevalue text
For example, If I've seelcted "Batteries, Beans, Wheat" in this editor the property value would be something like "62,75,85" which is what I'm wanting. If I only select "Batteries", the property value returns as "Batteries". Naturall, this makes it very difficult to a comparison amongst all nodes.
Is there an easy way to guarantee that the prevalue ID is always returned?
Thank you for the reply. I suppose I could convert all prevalue ID's across the board into string and compare the strings however it seems like it would add more overhead that I would like. My goal is to take the few values that come in as strings and convert them to ID's. In the backend I don't really need or want to do string comparison. To give you a better idea of the issue. I've attached a value list. I've had to obfuscate some of the data but the value column shows what happens when I pull the value of a property with multiple selected items vs. one with a single selection.
This is the code that I use to access this property and the output table.
This is happening to me too using Umbraco 7. I can't understand why this would be an expected behavior, if I'm using 'dropdown list multiple publishing keys', I expect the component to always store the selected keys, be it one or more, and not a mix..... also I find it to be somewhat erratic, if I republish the nodes, sometimes the key gets sotred for elements with only one selected value, but then if I republish it or publish a sibiling node, the text for the key gets saved instead.
Is there a way I can fix this? I want the key/id for the selected dropdown items to be saved in the content node, even if the selected item is only one.
DropdownlistMultiplePublishKeys editor returns prevalue text if only one item is selected
Hi There - I am trying to use the DropdownlistMultiplePublishKeys editor to categorize some nodes. Some nodes will have single categories while others may have multiple.
The issue that I'm having is that if there are multiple prevalues selected, the value of the property is a comma seperated list as I was expecting. For single selections however, the property returns the prevalue text
For example, If I've seelcted "Batteries, Beans, Wheat" in this editor the property value would be something like "62,75,85" which is what I'm wanting. If I only select "Batteries", the property value returns as "Batteries". Naturall, this makes it very difficult to a comparison amongst all nodes.
Is there an easy way to guarantee that the prevalue ID is always returned?
Hi Andrew
Could this be what you're after? http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/helper-to-get-prevalue-string-from-a-dropdown
/Jan
Thank you for the reply. I suppose I could convert all prevalue ID's across the board into string and compare the strings however it seems like it would add more overhead that I would like. My goal is to take the few values that come in as strings and convert them to ID's. In the backend I don't really need or want to do string comparison. To give you a better idea of the issue. I've attached a value list. I've had to obfuscate some of the data but the value column shows what happens when I pull the value of a property with multiple selected items vs. one with a single selection.
This is the code that I use to access this property and the output table.
My appologies. To clarify, I'm trying to convert all values to integers, not strings.
Hello,
This is happening to me too using Umbraco 7. I can't understand why this would be an expected behavior,
if I'm using 'dropdown list multiple publishing keys', I expect the component to always store the selected keys, be it one or more, and not a mix.....
also I find it to be somewhat erratic, if I republish the nodes, sometimes the key gets sotred for elements with only one selected value, but then if I republish it or publish a sibiling node, the text for the key gets saved instead.
Is there a way I can fix this? I want the key/id for the selected dropdown items to be saved in the content node, even if the selected item is only one.
is working on a reply...