Copied to clipboard

Flag this post as spam?

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


  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    May 18, 2018 @ 03:09
    Heather Floyd
    0

    Nested Content - Dropdown value is missing on retrieval

    Hello, I have a very odd issue that I hope someone can assist with.

    In an Umbraco v.7.10.3 site I have a doctype "Recipe" with a Nested Content property named "Instructions". The Nested Content item has two properties - a Textarea ("InstructionText") and a simple drop-down ("TextType")

    In the back-office, I can add multiple "Instructions" to a Recipe and I see the drop-down value displayed properly. If I save the Recipe and come back to it, the instructions are still showing proper drop-down values.

    However, when I attempt to render the data in a View, "TextType" is always null.

    example Razor:

    var rIpub = Umbraco.AssignedContentItem;
    var rInstrIpub = rIpub.GetPropertyValue<IEnumerable<IPublishedContent>>("Instructions");
    var firstTest = rInstrIpub.FirstOrDefault().GetPropertyValue("TextType"); <--- NULL 
    

    When I checked the XML data in umbraco.config, I see that it is saving an empty string for all the TextType properties:

    <Instructions><![CDATA[[
    {"key":"23de4eed-b446-4313-b070-0f137b878d41","name":"Preheat oven to 450º F.","ncContentTypeAlias":"ncRecipeInstruction","InstructionText":"Preheat oven to 450º F.","TextType":""},
    {"key":"fc025a97-21a8-493d-8d17-97040b472348","name":"Brush each pizza crust with olive oil.","ncContentTypeAlias":"ncRecipeInstruction","InstructionText":"Brush each pizza crust with olive oil.","TextType":""}
    ...
    ]]]></Instructions>
    

    This seems like a bug... so I have logged it as an issue (http://issues.umbraco.org/issue/U4-11348) but I was wondering if anyone else had encountered it...?

  • Nigel Wilson 945 posts 2077 karma points
    May 18, 2018 @ 03:10
    Nigel Wilson
    0

    Hi Heather

    GetPropertyValue("TextType") - should this be GetPropertyValue("textType")

    ie, lowercase t

    Cheers

    Nigel

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    May 18, 2018 @ 03:14
    Heather Floyd
    0

    Thank you for your response, Nigel, however my properties are title cased (I know I am peculiar). You can verify it in the umbraco.config sample I included. Just because stranger things have happened, I went ahead and re-ran my Razor test using your suggestion, but as I suspected, the value is still NULL.

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    May 18, 2018 @ 14:01
    Heather Floyd
    101

    It seems that an update to Umbraco v. 7.10.4 (and re-saving the nested content datatype in question) fixed this.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 28, 2018 @ 17:35
    Lee Kelleher
    1

    Hi Heather, just to follow up on this - the #U4-11184 patch did fix this issue. It was a long standing bug with Nested Content.

  • Heather Floyd 610 posts 1032 karma points MVP 6x c-trib
    May 29, 2018 @ 17:37
    Heather Floyd
    0

    Thanks, Lee.

    I've made an update to the issue, for future reference. :-)

  • M N 125 posts 212 karma points
    Jun 22, 2018 @ 16:30
    M N
    0

    Thanks for the bread crumbs! In my situation I'm still using the original .5 Nested Content package as it was too significant to move everything to Umbraco's Shipped NC, but I'm also on Umbraco 7.10.4

    I had to add a new drop down, and was experiencing this issue where the value was always NULL. As a workaround to this issue, you can also manually modify the data type in the database to use the legacy drop down.

    1) Go to Developer -> Data Types -> The Drop Down In Question

    2) Note the ID /umbraco/#/developer/dataTypes/edit/123456

    3) Open SSMS, cmsDataType table, find your data type and change the propertyEditorAlias to Umbraco.DropDown which I assume is the legacy drop down?

    4) Restart your app, resave content.

    Hope that helps someone in a crunch.

Please Sign in or register to post replies

Write your reply to:

Draft