Get "Text" instead of "Value" from Radiobutton-datatype
I have made a datatype based on the Radiobutton List. I have to options in it and this works just fine. I have put my new datatype on a field in Umbraco with an alias of: sendMailTo
But when I need to know what the admin have choosen from sendMailTo I get the actual Value from the datatype - The id of the choosen option. Sure I can check if the value is 45 or 46, but right now I work on a development-environment, and when I'm moving the whole site to a test-environment, I can't be sure that the two id's will be the same except if I move the whole database as well. I could of cource change the id's in my XSLT-code, but then I needed to chage it once more when the site is going to a staging-environment, and then once again when the site goes live.
So my question is: Can I grab the text from the choosen option, instead of the value?
By the way - If I used the "Dropdown List" as my base datatype I'll get the text instead of the value, so it's kind of weird, why the same thing is not happening with the Radiobutton List.
Get "Text" instead of "Value" from Radiobutton-datatype
I have made a datatype based on the Radiobutton List. I have to options in it and this works just fine. I have put my new datatype on a field in Umbraco with an alias of: sendMailTo
But when I need to know what the admin have choosen from sendMailTo I get the actual Value from the datatype - The id of the choosen option. Sure I can check if the value is 45 or 46, but right now I work on a development-environment, and when I'm moving the whole site to a test-environment, I can't be sure that the two id's will be the same except if I move the whole database as well. I could of cource change the id's in my XSLT-code, but then I needed to chage it once more when the site is going to a staging-environment, and then once again when the site goes live.
So my question is: Can I grab the text from the choosen option, instead of the value?
By the way - If I used the "Dropdown List" as my base datatype I'll get the text instead of the value, so it's kind of weird, why the same thing is not happening with the Radiobutton List.
- Thanks
/Kim A
will do the trick...Just put in the prevalue id you got from the radiobutton list.
hth, Thomas
Thanks Thomas. This works just like I hoped for :)
Have a nice day.
/Kim A
Can you give an example of this?
I have my datatype on RadioButton list with two values, Open/Closed.
So when I put in my template: <umbraco:Item runat='server' field='cutOpen' /> it displays 11 or 12
So I am not sure how to change that to use umbraco.library:GetPreValueAsString ?
Thanks
This is what I tried
<umbraco:Item runat="server" field="cutOpen" xslt="umbraco.library:GetPreValueAsString({0})/data[@alias='cutOpen']" />
But getting nothing back?
Thanks
As the name says: it returns a string so this should work:
hth, Thomas
Excellent! Thank you!
This also works in Razor:
i found this that worked for me:
@umbraco.library.GetPreValueAsString(int.Parse(node.property))
i also tried and it was working for me.
Thanks !!
is working on a reply...