combining SPCascadeDropdowns and SPFilteredDropdowns

Jul 20 at 1:10 PM
Hi, I have these two scripts working indepedently, however I finding it hard to combine them.

Reffering to the usual country / states examples, when I select country : the cascade would filter the states; what I'm trying to achieve is that filter only the 'active' states...

I understand that the order I execute de scripts matter, however the results populating the active ones is not very accurate.

I'm sure there is a better way to do this, i'm not an usual coder, so I'm digging my way...Any suggestions/help would be very appreciated

this is de script on my newform.aspx
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">


<script type="text/javascript"> 
    $(document).ready(function(){

        $().SPServices.SPFilterDropdown({
            relationshipWebURL: "",
            relationshipList: "Contratos de Suporte",  //STATES to be filtered by ACTIVE field
            relationshipListColumn: "Title",
            relationshipListSortAscending: true,  // Added in 2013.01
            relationshipListSortColumn: "Title",
            columnName: "Contrato",
            listName: $().SPServices.SPListNameFromUrl(),
            promptText: "",
            noneText: "(None)",
            CAMLQuery: "<Eq><FieldRef Name='Ativo' /><Value Type='Boolean'>1</Value></Eq>",
            CAMLQueryOptions: "<QueryOptions></QueryOptions>",
            completefunc: null,
            debug: false
        });
    
        $().SPServices.SPCascadeDropdowns({
        relationshipList: "Contratos de Suporte",    //STATES
            relationshipListParentColumn: "Cliente",   //COUNTRIES
            relationshipListChildColumn: "Title",
            parentColumn: "Cliente",
            childColumn: "Contrato",
            debug: false
        });
   });
    </script>
> 
If I change the order the filter overrides the cascade completly.

thank you
Coordinator
Jul 20 at 2:32 PM
@dbarroco:

You can do the filtering right in SPCascadeDropdowns, rather than trying to use the two functions together. You can add the CAMLQuery into SPCascadeDropdowns and you should be all set:
        $().SPServices.SPCascadeDropdowns({
        relationshipList: "Contratos de Suporte",    //STATES
            relationshipListParentColumn: "Cliente",   //COUNTRIES
            relationshipListChildColumn: "Title",
            parentColumn: "Cliente",
            childColumn: "Contrato",
            CAMLQuery: "<Eq><FieldRef Name='Ativo' /><Value Type='Boolean'>1</Value></Eq>"
        });
M.
Marked as answer by dbarroco on 7/20/2016 at 7:44 AM
Jul 20 at 2:46 PM
right you are! :D

I was not seeing that, worked like a charm!

Thank you very much
Coordinator
Jul 20 at 3:08 PM
Sure thing!