Copied to clipboard

Flag this post as spam?

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


  • Matt 91 posts 237 karma points
    Apr 08, 2013 @ 13:30
    Matt
    0

    True/False doesn't have default value?

    I'm not sure if this is intentional, but a True/False property has no value until I manually check it.

    For example I have created a field "hideInNav" of type True/False, which is used to hide particular pages. The problem is "false" is not set on all pages even though the checkbox is unchecked, until I check the box and then uncheck and save. I have a large number of pages which will take a long time to manually do this, and need the default functionality for any new pages.

    Is this a bug or how the datatype works by default? 

  • gary 385 posts 916 karma points
    Apr 09, 2013 @ 00:22
    gary
    0

    Hi Matt

    Not experienced this before, what version are you using?

    However, to hide pages, if you create the property of hide in Nav, but with an alias of umbracoNaviHide, of type true/false you will be able to use a where statement of "visible",

    var blob = CurrentPage.AncestorsOrSelf().Children.Where("Visible"). rather than true statements.

    If you already have all your code in place and this is a bit late, all I can suggest is that it is a cache issue, right click top node and re-publish entire site, that may help, my thinking is that the property doesn't yet exist so if you query against the cache, is is not null, it just doesn't yet exist.

    Hope that makes sense and can be useful.

    Regards

    G

  • Matt 91 posts 237 karma points
    Apr 09, 2013 @ 10:26
    Matt
    0

    Hi Gary,

    Thanks for the help.

    I'm using v6.0.3

    I tried clearing the cache as you suggested but still no luck. I'll look further to see if this is a new bug. 

    Im aware of umbracoNaviHide but I think I need a different checkbox for the functionality I need.

    I am trying to hide specific pages from the navigation, but this will also hide all children belonging to that page using the example razor navigation cshtmls. I need to show some of these children, for example:

    About

    Store

        Shoes

             Shoe 1

         Hats

              Hat 1

    Contact

     

    I need the "Store" node to be hidden, and shoes/hats as menu items. So About, Store, Shoes, Hats, Contact. I would simply delete the Store node however it is required for the ecommerce package I am using.

    Many thanks for any help 

  • gary 385 posts 916 karma points
    Apr 09, 2013 @ 10:55
    gary
    0

    Hi Matt

    Still on 6.0.2 and haven't seen that behaviour in true/false but will have a look when I can

    To hide the Store node you could do a where

    so for nav, along the lines of

    @CurrentPage. AncestorsOrSelf(). Descendants.Where ("NodeTypeAlias != \"YourDocTypeAliasForStore\"").Where("Visible)

    That then gives the 2 options, ie store not shown but any other page can be hidden from the nav idependently.

    It is a method that I use, for top level.

    Note, I think it has to be on the dynamic CurrentPage rather than Model.

    Cheers

    G

  • Matt 91 posts 237 karma points
    Apr 09, 2013 @ 11:48
    Matt
    0

    Thanks Gary,

    Didn't think of that Where statement, d'oh!

    All sorted now.

    Removes the need for the checkbox but might be worth looking into incase it is a bug.

  • gary 385 posts 916 karma points
    Apr 09, 2013 @ 11:59
    gary
    100

    Hi

    Think it's a case of, we are all still learning. When I look back at some code I wrote a while back, hmmmm, who wrote that??

    I first used the method you did, so it must be logical, but remember that it bit me later with kinda double logic, if, if not, got very confusing, hence my suggestion. 

    Glad it helped and will defo have a look at the checkbox, if I can confirm then best report it, but think it is good to get a second opinion on a possible bug.

    Cheers

    G

     

Please Sign in or register to post replies

Write your reply to:

Draft