SPServices.SPCascadeDropdowns issue.

Aug 22, 2011 at 8:21 AM
Edited Aug 22, 2011 at 8:34 AM

Thanks to MarcD for redirect me to post question in Codeplex.

I can make BizzCentre dropdownlist to trigger filter into CreditOfficer & SalesOfficer dropdown list value in NewForm.aspx & EditForm.aspx but not in the custom list form that I've create.

It is same either I use Single Item Form or Multiple Item Form I still cannot make it to cascade two dropdown list at the same time.

I got this list ; BizzCentre, CreditOfficer & SalesOfficer.

 

BizzCentre list

Title
Centre A
Centre B
Centre C

 

CreditOfficer list

Title Officer Name
Centre A James
Centre B Michael
Centre C Deric
Centre A Bob
Centre B Shery
Centre C Clark
Centre A Justin
Centre B Maria
Centre C Donald

 

SalesOfficer list

Title Officer Name
Centre A Billy
Centre B Jenny
Centre C Armstrong
Centre A Ramirez
Centre B John
Centre C Kelly
Centre A Robert
Centre B Percy
Centre C Phillip

I want it more or less to be like this ;

Select BizzCentre 
<select> 
   <option value="Centre A">BizzCentre A</option>
   <option value="Centre B">BizzCentre B</option>   
   <option value="Centre C">BizzCentre C</option>
</select>
---------------------------------
Select CreditOfficer 
<select>
   <option value="James">James</option>
   <option value="Michael">Michael</option>
   <option value="Deric">Deric</option>
   <option value="Bob">Bob</option>
   <option value="Shery">Shery</option>
   <option value="Clark">Clark</option>
   <option value="Justin">Justin</option>
   <option value="Maria">Maria</option>
   <option value="Donald">Donald</option> 
</select>

Select SalesOfficer 
<select> 
   <option value="Billy">Billy</option>
   <option value="Jenny">Jenny</option>
   <option value="Armstrong">Armstrong</option>
   <option value="Ramirez">Ramirez</option>
   <option value="John">John</option>
   <option value="Kelly">Kelly</option>
   <option value="Robert">Robert</option>
   <option value="Percy">Percy</option>
   <option value="Phillip">Phillip</option> 
</select>


So how do I get BizzCentre dropdown list to trigger filter on both CreditOfficer & SalesOfficer dropdown list value base on their Centre?

This is the script that I use on my page to cascade the value.

 

<script language="javascript" type="text/javascript" src="HIDE URL/CBLT/Script/jquery-1.3.2.min.js"></script>

<script language="javascript" type="text/javascript" src="HIDE URL/CBLT/Script/jquery.SPServices-0.6.2.min.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipList: "CreditOfficer",
relationshipListParentColumn: "BizzCentre",
relationshipListChildColumn: "Title",
parentColumn: "BizzCentre",
childColumn: "Credit Officer",
debug: true
});

});</script>
<script language="javascript" type="text/javascript" src="HIDE URL/CBLT/Script/jquery-1.3.2.min.js"></script>

<script language="javascript" type="text/javascript" src="HIDE URL/CBLT/Script/jquery.SPServices-0.6.2.min.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
$().SPServices.SPCascadeDropdowns({
relationshipList: "SalesOfficer",
relationshipListParentColumn: "BizzCentre",
relationshipListChildColumn: "Title",
parentColumn: "BizzCentre",
childColumn: "Sales Officer",
debug: true
});

});</script>
Coordinator
Aug 22, 2011 at 10:32 PM

Well, it seems that there are a couple of things going on here.

First of all, if you've customized your form, then there's no guarantee that SPCascadeDropdowns will work. It is looking for the markup which is generated by the default forms. If you generate your own markup, it's certainly likely that it doesn't look the same.

Second, you are referencing the script libraries twice, which will probably make things act strange.

It ought to look more like this:

<script language="javascript" type="text/javascript" src="HIDE URL/CBLT/Script/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="HIDE URL/CBLT/Script/jquery.SPServices-0.6.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "CreditOfficer",
    relationshipListParentColumn: "BizzCentre",
    relationshipListChildColumn: "Title",
    parentColumn: "BizzCentre",
    childColumn: "Credit Officer",
   debug: true
  });
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "SalesOfficer",
    relationshipListParentColumn: "BizzCentre",
    relationshipListChildColumn: "Title",
    parentColumn: "BizzCentre",
    childColumn: "Sales Officer",
    debug: true
  });
});
</script>

Third, your lists aren't set up properly. The Credit Officer list should have a Lookup column to the BizzCentre list to get the values for BizzCentre, for instance. Look at the docs and the Country/Region/State example to see how this ought to work.

M.