Hi,
I'm using jQuery 1.11.0, SPServices 2013.02a and SharePoint 2010. I can get the SPCascadeDropdowns to work fine using the demo methods within the documentation so I'm happy with that. However I have three dropdown levels, with my third level being dependent on one of three lookup columns within the relationshipList. I've tried to achieve this by nesting the SPCascadeDropdown functions within if statements on the top level dropdown's change event. All dropdowns works fine but only for the first time after page load. When the top level dropdown is changed, the third level doesn't work. I know that the change event is being fired as I get the alerts.
Any help would be appreciated.
```
// First and second level dropdowns
$().SPServices.SPCascadeDropdowns({
relationshipList: "Regions",
relationshipListParentColumn: "Country",
relationshipListChildColumn: "Title",
parentColumn: "Country",
childColumn: "Region"
});
// Third level dropdown
$( 'select[title="state"]' ).on( "change", function(){
if ($(this).val() == "1") {
//alert( $(this).val() );
$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Region_x0020_1",
relationshipListChildColumn: "Title",
CAMLQuery: "<Eq><FieldRef Name='Num'/><Value Type='Text'>4</Value></Eq>",
parentColumn: "Region",
childColumn: "State"
});
}
if ($(this).val() == "2") {
//alert( $(this).val() );
$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Region_x0020_2",
relationshipListChildColumn: "Title",
CAMLQuery: "<Eq><FieldRef Name='Num'/><Value Type='Text'>4</Value></Eq>",
parentColumn: "Region",
childColumn: "State"
});
}
if ($(this).val() == "3") {
//alert( $(this).val() );
$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Region_x0020_3",
relationshipListChildColumn: "Title",
CAMLQuery: "<Eq><FieldRef Name='Num'/><Value Type='Text'>4</Value></Eq>",
parentColumn: "Region",
childColumn: "State"
});
}
});
```
Comments: Okay. I've moved to discussions.
I'm using jQuery 1.11.0, SPServices 2013.02a and SharePoint 2010. I can get the SPCascadeDropdowns to work fine using the demo methods within the documentation so I'm happy with that. However I have three dropdown levels, with my third level being dependent on one of three lookup columns within the relationshipList. I've tried to achieve this by nesting the SPCascadeDropdown functions within if statements on the top level dropdown's change event. All dropdowns works fine but only for the first time after page load. When the top level dropdown is changed, the third level doesn't work. I know that the change event is being fired as I get the alerts.
Any help would be appreciated.
```
// First and second level dropdowns
$().SPServices.SPCascadeDropdowns({
relationshipList: "Regions",
relationshipListParentColumn: "Country",
relationshipListChildColumn: "Title",
parentColumn: "Country",
childColumn: "Region"
});
// Third level dropdown
$( 'select[title="state"]' ).on( "change", function(){
if ($(this).val() == "1") {
//alert( $(this).val() );
$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Region_x0020_1",
relationshipListChildColumn: "Title",
CAMLQuery: "<Eq><FieldRef Name='Num'/><Value Type='Text'>4</Value></Eq>",
parentColumn: "Region",
childColumn: "State"
});
}
if ($(this).val() == "2") {
//alert( $(this).val() );
$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Region_x0020_2",
relationshipListChildColumn: "Title",
CAMLQuery: "<Eq><FieldRef Name='Num'/><Value Type='Text'>4</Value></Eq>",
parentColumn: "Region",
childColumn: "State"
});
}
if ($(this).val() == "3") {
//alert( $(this).val() );
$().SPServices.SPCascadeDropdowns({
relationshipList: "States",
relationshipListParentColumn: "Region_x0020_3",
relationshipListChildColumn: "Title",
CAMLQuery: "<Eq><FieldRef Name='Num'/><Value Type='Text'>4</Value></Eq>",
parentColumn: "Region",
childColumn: "State"
});
}
});
```
Comments: Okay. I've moved to discussions.