This project has moved and is read-only. For the latest updates, please go here.

SP2010 - SPCascadeDropdown with SPFilterDropDowns

Jul 2, 2014 at 5:57 PM
Ok, so I know in SPCascadeDropdown you can't have more than one parent column. So I thought instead of using a second parent column, I could force it to pull the Lookup value and force the 3rd field to populate based upon a Filter matching on the ID of the item in the list.... Here's a breakdown of lists:


ApplicationName(Lookup on TRApplication)

The issue is the ServerName. In TREnvironments, I needed it to look at the ApplicationName AND the EnvironmentName to pick the ServerName. If I were to do a SPCascadeDropdown match on the EnvironmentName, it would return multiple values due to the fact that there are repeats in that column. There are UNIQUE matches on the ApplicationName AND EnvironmentName. So my thought was to pull the ID(Value) of the Lookup and use SPFilter to filter the ServerName based upon ID (in the list).

So here is my code:
$(document).ready(function() {
    relationshipList: "TREnvironments",
    relationshipListParentColumn: "ApplicationName",
    relationshipListChildColumn: "EnvironmentName",
    parentColumn: "ApplicationSource",
    childColumn: "EnvironmentSource"
var EnvSourceValue = $("select[title='EnvironmentSource']").val();

  relationshipList: "TREnvironments",
  relationshipListColumn: "ServerName",
  columnName: "DataSource",
  CAMLQuery: "<Eq><FieldRef Name='ID' /><Value Type='Text'>" + EnvSourceValue + "</Value></Eq>",
  completefunc: null,
  debug: false
The variable is populating with "0" due to the fact that it defaults to (none).... how can I get it to pull the NEW value once I choose an option for my EnvironmentSource? I've tried adding this, but it didn't work:
$("select[title='EnvironmentSource']").change(function() {
   var EnvSourceValue = $("select[title='EnvironmentSource']").val()