Copied to clipboard

Flag this post as spam?

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


  • Carlos 338 posts 472 karma points
    Sep 10, 2014 @ 20:20
    Carlos
    0

    Using Datatype Prevalues to filter nodes on front end

    We are going to be building a form with Umbraco 7.1 and MVC and we are going to be getting the Prevalues from checkbox datatypes we set up to show on the frontend through a simple form.

    We found how to get the Prevalues form our Datatypes through Razor using this

    var dataTypeId = umbraco.cms.businesslogic.datatype.DataTypeDefinition.GetAll().First(d=> d.Text == "DataTypeName").Id;
    
    var preValues = PreValues.GetPreValues(dataTypeId).Values;
    var enumerator = preValues.GetEnumerator();
    while (enumerator.MoveNext())
    {
        var preValueText = ((PreValue)enumerator.Current).Value;
        <option>@preValueText</option>
    }
    

     

    Our nodes have the values from the datatypes defined within them.

    How would be filter the Nodes by the prevalues selected from a form submission?  Meaning, how would we match nodes by the selected values.  

    Example: 

    Dataype 1 - Checkbox list
    DT1 Option 1
    DT1 Option 2
    DT1 Option 3

    Dataype 2 - Checkbox list
    DT2 Option 1
    DT2 Option 2
    DT2 Option 3

    How would we get or filter all nodes, on form submission, that match Datatype 1 and Datatype 2 options?

     

    Thnaks in advance.

Please Sign in or register to post replies

Write your reply to:

Draft