DropDown List and DropDown List - Publishing keys both return the prevalue
Am I missing the obvious here, do I interpret the documentation wrong, or have I found a (solved) issue?
The DropDown List displays a list of preset values. The value
saved is a text value. In the example I expect the actual value to be
"Superman".
The DropDown List - Publishing keys displays a list
of preset values. The value saved is the prevalue id. In the example
an int, say 159.
In my case, using Umbraco 7.1.9 but also in another solution running Umbraco 7.2.2, using these DropDowns the value is either "159" (as a string) or 159 (as an int). But the prevalue, instead of "Superman" and 159.
That's what I understand, Jeavon. But how I read the docs, is that when using the DropDown List - Publishing keyes, saves the prevalue id, 159 in my example. Using the DropDown List saves the text value, "Superman", not the prevalue as a string.
However, when debugging I notice that both editors to save the prevalue, one as string and one as int.
Model.Content.GetPropertyValue<string>("character") //returns "159" using the DropDown List
Model.Content.GetPropertyValue<int>("character") //returns 159 using the DropDown List - Publishing keys
Wait, hold your horses! I figured out that in one solution I was not using a IPublishedContent but an IMedia object to get the property from. I needed to manually update a property's value in an event, thus I needed to use the MediaService, returning an IMedia object.
Using Umbraco.TypedMedia(1234), returns IPublishedContent, I can use GetPropertyValue
Ah yes, that's expected. Even when using "DropDown List" at the database level it stores the prevalue id, but IPublishedContent resolves it's value before caching unlike "DropDown List - Publishing keys". So when using management API's like IMedia you should be able to get and set the database values.
And in the other solution I've found that the DropDown List just works as expected as well. Instead of using this DropDown List, I was using a RadioButton List that saves the prevalue ids, not the values.
How difficult would it be to also create a RadioButton List and a RadioButton List - Publishing keys (which is the current implementation)? Would be nice if that editor would be included by default as well, then all editors have the same publishing behaviour. I noticed that a CheckBox List also saves the selected value, not the prevalue id.
These editors have been around for a very long time and their names are a bit confusing.
You are right , "Radiobutton List" should really be called "Radiobutton List - Publishing Keys" as it returns the prevalue id's and
"Checkbox List" returns the value only, there isn't a "Checkbox List - Publishing Keys".
I would suggest looking at nuPickers, you could use the Json or XML data source and point to a file you would need to create with the key/value pairs in it?
Indeed, and it would be nice if there was a RadioButton List (publishing values) too. A CheckBox List - Publishing Keys would complete the set. On the wishlist, can't be that difficult ;-)
I took a look at the nuPickers, but I don't want to introduce them into this package, only for the need of a radiobutton list that saves values.
DropDown List and DropDown List - Publishing keys both return the prevalue
Am I missing the obvious here, do I interpret the documentation wrong, or have I found a (solved) issue?
In my case, using Umbraco 7.1.9 but also in another solution running Umbraco 7.2.2, using these DropDowns the value is either "159" (as a string) or 159 (as an int). But the prevalue, instead of "Superman" and 159.
Hi,
I'm sure I totally follow. To ensure you always get a int specify the type, e.g.
Am I miss understanding you?
Jeavon
That's what I understand, Jeavon. But how I read the docs, is that when using the DropDown List - Publishing keyes, saves the prevalue id, 159 in my example. Using the DropDown List saves the text value, "Superman", not the prevalue as a string.
However, when debugging I notice that both editors to save the prevalue, one as string and one as int.
Oh, that's not right, I'll see if I can reproduce!
Wait, hold your horses! I figured out that in one solution I was not using a IPublishedContent but an IMedia object to get the property from. I needed to manually update a property's value in an event, thus I needed to use the MediaService, returning an IMedia object.
Using Umbraco.TypedMedia(1234), returns IPublishedContent, I can use GetPropertyValue
Ah yes, that's expected. Even when using "DropDown List" at the database level it stores the prevalue id, but IPublishedContent resolves it's value before caching unlike "DropDown List - Publishing keys". So when using management API's like IMedia you should be able to get and set the database values.
And in the other solution I've found that the DropDown List just works as expected as well. Instead of using this DropDown List, I was using a RadioButton List that saves the prevalue ids, not the values.
How difficult would it be to also create a RadioButton List and a RadioButton List - Publishing keys (which is the current implementation)? Would be nice if that editor would be included by default as well, then all editors have the same publishing behaviour. I noticed that a CheckBox List also saves the selected value, not the prevalue id.
These editors have been around for a very long time and their names are a bit confusing.
You are right , "Radiobutton List" should really be called "Radiobutton List - Publishing Keys" as it returns the prevalue id's and "Checkbox List" returns the value only, there isn't a "Checkbox List - Publishing Keys".
I would suggest looking at nuPickers, you could use the Json or XML data source and point to a file you would need to create with the key/value pairs in it?
Indeed, and it would be nice if there was a RadioButton List (publishing values) too. A CheckBox List - Publishing Keys would complete the set. On the wishlist, can't be that difficult ;-)
I took a look at the nuPickers, but I don't want to introduce them into this package, only for the need of a radiobutton list that saves values.
is working on a reply...