Cannot set initial values in Cascading DropDowns

Nov 4, 2013 at 7:53 PM
I have a single list with 4 columns. Region, Installation, Brigade, Organization. I have a cascading drop down for each of these.
$("select[title='Region'] option[value='"+ UserRegion +"']").attr('selected', 'selected');
$().SPServices.SPCascadeDropdowns({
  relationshipList: "OrgList",
  relationshipListParentColumn: "Title",
  relationshipListChildColumn: "Installation",
  relationshipListSortColumn: "Title",
  parentColumn: "Region",
  childColumn: "Installation",
  simpleChild: true,
  completefunc: function() {
    TARegion = $("select[title='Region'] option:selected").text();
  },
  debug: true
}); 

$("select[title='Installation'] option[value='"+ UserInstallation +"']").attr('selected', 'selected');
$().SPServices.SPCascadeDropdowns({
  relationshipList: "OrgList",
  relationshipListParentColumn: "Installation",
  relationshipListChildColumn: "Column3",
  relationshipListSortColumn: "Title",
  parentColumn: "Installation",
  childColumn: "Brigade",
  simpleChild: true,
  completefunc: function() {
    TAInstallation = $("select[title='Installation'] option:selected").text();
  },
  debug: true
}); 

$("select[title='Brigade'] option[value='"+ UserBrigade +"']").attr('selected', 'selected');
$().SPServices.SPCascadeDropdowns({
  relationshipList: "OrgList",
  relationshipListParentColumn: "Column3",
  relationshipListChildColumn: "Column4",
  relationshipListSortColumn: "Title",
  parentColumn: "Brigade",
  childColumn: "Organization",
  simpleChild: true,
  completefunc: function() {
    TABrigade = $("select[title='Brigade'] option:selected").text();
  },
  debug: true
}); 
$("select[title='Organization'] option[value='"+ UserOrg +"']").attr('selected', 'selected');
I get the Region and Installation selected properly. The Brigade has the values filled in but is not selected to the initial value and therefore the Organization list is empty.

What am I doing wrong?

Also is there any way to remove duplicates in the drop down lists?
Coordinator
Nov 6, 2013 at 2:42 PM
If you have duplicated in the dropdowns, it's because you have duplicates in the lookup lists.

It looks like you are attempting to store all of the relationships in the OrgList rather than one list per relationship, per good database design.

Take a look at the docs to see how I set up the Country/Region/State example.

M.