Display posts that have multiple categories selected?
Hello,
I have a doctype that has a category checkboxlist data type on it. For my navigation I am trying to filter it based off what is selected for the category checkboxlist. The following code works fine for when I am trying to pull the pages with just one category selected.
I was hoping the contains would work and pull the pages that also have other checkboxlists checked as well. Unfortunately this causes the script to not pull anything. Is there something special I should be doing when dealing with multiple checked checkboxes? When I try to return the value of the checkbox property when two are selected I get nothing. Unlike when just one thing is checked. Am I going about this the wrong way? Thanks for any help!
Interesting, i think i actually saw that behaviour in V6.0.2 but didn't beleive it, I then tried on a clean v6.0.3 and it worked fine. Could you try upgrading? I think you will need to upgrade to to v6.0.5 for the security patch very soon anyway :-)
Wow you were right! It does look like 6.0.2 has an error with multiple checkbox values. I upgraded to 6.0.5 and my original method works fine. I really appreciate the help!
Display posts that have multiple categories selected?
Hello,
I have a doctype that has a category checkboxlist data type on it. For my navigation I am trying to filter it based off what is selected for the category checkboxlist. The following code works fine for when I am trying to pull the pages with just one category selected.
I was hoping the contains would work and pull the pages that also have other checkboxlists checked as well. Unfortunately this causes the script to not pull anything. Is there something special I should be doing when dealing with multiple checked checkboxes? When I try to return the value of the checkbox property when two are selected I get nothing. Unlike when just one thing is checked. Am I going about this the wrong way? Thanks for any help!
Hi, I don't see anything wrong with what you have done, could it be a case sensitivity issue? Maybe try:
if (items.category.IndexOf("future", StringComparison.OrdinalIgnoreCase) >= 0)
{
<li><a href="@items.Url">@items.Title</a></li>
}
Also, what version of Umbraco are you using?
I am using Umbraco v6.0.2.
This is above that code, maybe there is a problem here?
Interesting, i think i actually saw that behaviour in V6.0.2 but didn't beleive it, I then tried on a clean v6.0.3 and it worked fine. Could you try upgrading? I think you will need to upgrade to to v6.0.5 for the security patch very soon anyway :-)
Wow you were right! It does look like 6.0.2 has an error with multiple checkbox values. I upgraded to 6.0.5 and my original method works fine. I really appreciate the help!
Awesome! Glad to have helped. Could you please mark the upgrade comment above as solution in case anyone else the same issue. Thanks!
FYI, the issue and resolution is detailed here http://issues.umbraco.org/issue/U4-1882
is working on a reply...