I recently had a need to show a value from a Drop Down DataType
I had created in my Umbraco UI - The backend users were using the
drop down to create content, but I needed people to be able to use
the values in the front end to also submit content via my HTML
pages.
In this tutorial I'll show how to recreate the dropdown list
DataType in the front end - To get the DataType values you need to
use a method from the umbraco.library() called
GetPreValues() where you need to pass in the ID of
the DataType [more]
- umbraco.library:GetPreValues('THEID')
To get the ID you just need to hover over your DataType and in
the footer of your browser you can get the ID (For example this one
has an ID of 1102)

Once you have the ID you can recreate the <select> (Drop
down list) by using the code below
- <select
name="eventType"
id="eventType"
>
- <option
value="0">Please
Choose</option>
- <xsl:variable
name="topicList"
select="umbraco.library:GetPreValues('1102')"
/>
- <xsl:for-each
select="$topicList//preValue"
>
- <option
value="{@id}"
>
- <xsl:value-of
select="current()"
/>
- </option>
-
</xsl:for-each>
- </select>
If you didn't want to have the ID as they value for the option
you can also do
- <option
value="{current()}"
>
- <xsl:value-of
select=
This entry was written by
Lee,
posted on
Tuesday, December 22, 2009
Bookmark the
permalink.
Follow any comments here with the
RSS feed for this post.
You can .