Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sigurd Aabøe-Sagen 12 posts 122 karma points
    Mar 04, 2016 @ 12:00
    Sigurd Aabøe-Sagen
    0

    List dropdown elements (datatypes) based on any pages that has it selected

    Hello. New with Umbraco, and new on the forum. I hope anyone can help.

    I have created a custom datatype based on the Dropdown multiple. This dropdown contains work disciplines (HR, Accounting etc). This is so connected to different pages in the umbraco admin. Nothing special here i guess.

    I am using the same dropdown in the frontend. Is it possible to list only the values in the dropdown that HAS an connecting page.

    So if i have; Value 1 Value 2 Value 3

    And only Value 1 and Value 3 has been selected on my pages. Then i just want to display Value 1 og Value 3 in my dropdown/list at the frontend.

    I hope i made my self understandable :-) Thanks in advance.

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Mar 04, 2016 @ 14:58
    Dennis Adolfi
    0

    You could probobly iterate all the Value:s but before you render the options in the dropdown, you could do a check if there is any nodes with the same dropdown value as the option.

    var pages = uQuery.GetNodesByXPath("//*[string(workDisciplinId) = option.Id]");
    

    Note: the about code is not tested, its just a concept.

  • 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.

Please Sign in or register to post replies