I would like to create a dropdown list that is populated with certain page titles. Is this possible? I am using Umbraco 4 and know how you can create a new datatype such as a dropdown list then manually enter the selections available but I would like the list to show the title of pages in a certain section of the website. For example I have an editions page with sub-pages as shown below:
I would like to create a dropdown list datatype called "Editions" that lists the title of all the subpages of the Editions page and if I was to create another page called Spring 2009 under Editions I would like the dropdown list to then have "Spring 2009" as an option. Can this be done and if so can anyone point me in the right direction. Many thanks Tony
I'm sure an xslt would do fine here, you don't need to have a new datatype for this (It's would be too static as you'd have to add new prevalues when new pages are created).
The drop down list I want to create is going to need to go on a tab on a document type, is this going to be possible using the XSLT you specified. Basically the idea is that when someone creates a new Article (using the Article document type I have created) they are going to be able to select the Edition that the Article belongs to from a dropdown menu and as I mentioned previously I want the drop down to populate with a list of Editions.
Also I am new to all this XSLT business and not entirely sure which parts of your XSLT I would need to edit so that it picks up the correct pages to add to the dropdown. I really appreciate the help, cheers.
I have another question regarding this, I am now trying to filter results based on my dropdown list that I created but it doesn't seem to work. Am I right in thinking that the values in the dropdown are not stored as they appear? For example the dropdown is populated as shown:
Winter 2008
Autumn 2008
Summer 2008
Spring 2008
The dropdown alias is 'edition' and I want to filter results according to edition so I have used the following code in my XSLT:
Nothing seems to happen but if I try to filter using a dropdown that is manually populated then it works. Any ideas?
The picker will show you the node name, but it stores the node ID. You probably need to use umbraco.library:GetXmlNodeById() to get the node, then you can refer to to the @nodeName or whatever info you need.
Thank you for your reply, I did try this but unfortunately it doesn't seem to work, there is no output on the page, so far the code I have is as follows:
As mentioned previously I have a drop down menu on the "Article" document type that has the alias of "edition" and it is an ultimate picker that is populated by the child nodes of a page called "Edition List"which is as follows:
Edition List
-Winter 2008
-Autumn 2008
-Summer 2008
-Spring 2008
I appreciate any further help yourself or anyone else can offer. Cheers Tony
Dropdown populated with page titles
Hi,
I would like to create a dropdown list that is populated with certain page titles. Is this possible? I am using Umbraco 4 and know how you can create a new datatype such as a dropdown list then manually enter the selections available but I would like the list to show the title of pages in a certain section of the website. For example I have an editions page with sub-pages as shown below:
Editions
-Winter 2008
-Autumn 2008
-Summer 2008
-Spring 2008
I would like to create a dropdown list datatype called "Editions" that lists the title of all the subpages of the Editions page and if I was to create another page called Spring 2009 under Editions I would like the dropdown list to then have "Spring 2009" as an option. Can this be done and if so can anyone point me in the right direction. Many thanks Tony
Hi Tony,
I'm sure an xslt would do fine here, you don't need to have a new datatype for this (It's would be too static as you'd have to add new prevalues when new pages are created).
[code]
]>
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
[/code]
Above code snippet should get you started (will have to change some properties...)
Hope this helps.
Regards,
/Dirk
Hi Thanks for the response,
The drop down list I want to create is going to need to go on a tab on a document type, is this going to be possible using the XSLT you specified. Basically the idea is that when someone creates a new Article (using the Article document type I have created) they are going to be able to select the Edition that the Article belongs to from a dropdown menu and as I mentioned previously I want the drop down to populate with a list of Editions.
Also I am new to all this XSLT business and not entirely sure which parts of your XSLT I would need to edit so that it picks up the correct pages to add to the dropdown. I really appreciate the help, cheers.
I've used an "Ultimate Picker" to create a new Data Type. You give it a parent node ID and it then lists all child nodes.
The Data Type is then used on a Document Type to enable the selection of a number nodes.
I used it in Listitem mode, but it does dow dropdown too.
is that what you mean / need?
Thank you ascendinternet, that is exactly what I needed. That works perfectly.
Hi,
I have another question regarding this, I am now trying to filter results based on my dropdown list that I created but it doesn't seem to work. Am I right in thinking that the values in the dropdown are not stored as they appear? For example the dropdown is populated as shown:
Winter 2008
Autumn 2008
Summer 2008
Spring 2008
The dropdown alias is 'edition' and I want to filter results according to edition so I have used the following code in my XSLT:
Nothing seems to happen but if I try to filter using a dropdown that is manually populated then it works. Any ideas?
The picker will show you the node name, but it stores the node ID. You probably need to use umbraco.library:GetXmlNodeById() to get the node, then you can refer to to the @nodeName or whatever info you need.
Hi,
Thanks for the response, how do I use umbraco.library:GetXmlNodeById(), where would I put it in my code?
You basically pass it a nodeID and it returns the node. So, you would need something like -
[code]
Thank you for your reply, I did try this but unfortunately it doesn't seem to work, there is no output on the page, so far the code I have is as follows:
READ MORE
Published
As mentioned previously I have a drop down menu on the "Article" document type that has the alias of "edition" and it is an ultimate picker that is populated by the child nodes of a page called "Edition List"which is as follows:
Edition List
-Winter 2008
-Autumn 2008
-Summer 2008
-Spring 2008
I appreciate any further help yourself or anyone else can offer. Cheers Tony
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.