Correctly Setup List

Sep 15, 2009 at 5:59 PM
Edited Sep 15, 2009 at 6:01 PM

I suspect that the reason this is not working for me is because of how my list is setup. I am using two lookup columns to the same list different columns though. Choosing an item in the parent (Course Title) should result in only one displayed value in the child (Course ID). Unfortuantely the child lookup display "none" when the page is rendered and selecting a value in the parent drop-down (Course Title) is not having any effect on the child. Here is script for inspection.

<script type="text/javascript">
if(typeof jQuery=='undefined'){
 var jQPath = '/_layouts/jquery-1.3.2.min.js';
 document.write('<script src="',jQPath,'" type="text/javascript"><\/script>');
}
</script>
<script type="text/javascript" language="javascript" src="../../scripts/jquery.SPServices-0.2.9.js"></script>
<script type="text/javascript">

 $(document).ready(function(){ 
  $().SPServices.SPCascadeDropdowns({
   relationshipList: "Registrations",
   relationshipListParentColumn: "Course_x0020_Title",
   relationshipListChildColumn: "Course_x0020_ID",
   parentColumn: "Course Title",
   childColumn: "Course ID"
  });
 });

</script>

Thanks in advance

Marcus

Coordinator
Sep 15, 2009 at 6:07 PM

Marcus:

Could you tell me a bit more about the Registrations list?  What are its columns, how many items are there, etc? Also, how many items are there per Course Title? per Course ID?

It sounds like you're not really looking for "cascading", but rather linking.  What I mean is that you want a one-to-one relationship between Course Title and Course ID.  While the cascading ought to work, the user will still need to select that one Course ID, which probably isn't such a good user experience.

Also note that I just posted a new release that fixed a bug if there was an & in option values, plus other things.

Thanks,

M.

Sep 15, 2009 at 6:50 PM

Marc

Thanks for the quick response.

You are correct in regards to the one-to-one relationship but I wanted to use your SPServices because hopefully it will maintatin the sync if 20+ items exist in the drop-down and I wanted to use the SPDisplayRelatedlInfo. I am doing this now but the jquery solution is more elegant than mine and hopefully I can make the switch quickly. The Course ID will actually be a hidden field and I was hoping that once it changes its value based off the parent that I could submit the form with the displayed value (courseid.options[courseid.selectedIndex].value). Hope I'm making sense. I just don't understand why the Couse ID field is blank and Yes there are more than 20 items.

Coordinator
Sep 15, 2009 at 7:10 PM

If the Course ID is hidden (not on the form) then SPCascadeDropdowns won't work.  It relies on the fact that there are controls on the page for each column.

You could pretty easily do what you're trying to do with a simple SharePoint Designer-based workflow which just looks up the Course Title in the Registrations list and populates the Course ID.

M.