Cascading drop down saves wrong data.

Aug 25, 2015 at 1:52 PM
Hi,

I am currently trying to create a Helpdesk in SharePoint 2010. As part of this I have a couple of cascading drop downs created using SPServices. One of these is for Building -> Room. These seem to work on the actual form, they display the correct rooms for the selected building.

However, when I then click to save, the room quite often changes to a different room in a different building on the actual ticket. This is repeatable so say, building T2 Boiler Room, always changes the room to Room 1 (which is in building S1).

Any idea how to stop this? Some rooms work fine, but about 20% of them change after I click "save".

Thanks,

Jon
Coordinator
Aug 25, 2015 at 4:36 PM
Jon:

I can't think of any reason that would happen unless your underlying lists aren't set up right. The first thing that I would do is disable the cadcading and see if the form works properly without it. Then I'd look at the list structures.

M.
Aug 25, 2015 at 5:14 PM
Hi,

Thanks for the reply. First thing I did was trying to disable cascading etc and it works fine with it turned off. However this then displays the whole list of rooms (a few hundred items long) which is obviously not ideal.

The lists have 3 columns with data in, ID, Building and Room. I set the Title column as not required, would this affect it at all?

Obviously the Building name is repeated several times with it being the parent, but also the room name is sometimes replicated (several different buildings have a reception for example). Would this repetition cause any issues?

Thanks,

Jon
Aug 26, 2015 at 4:04 PM
Hi,

I have completely remade my "Rooms" list today and updated all the references but that did not help, the form displayed the correct rooms but then saved something different. I have got this fixed now by removing the "complex to simple" portions of the script.

My code had been:
<script type="text/javascript">
    $(document).ready(function (){
        $().SPServices.SPComplexToSimpleDropdown({
            columnName: "Building"
        });
      
        $().SPServices.SPComplexToSimpleDropdown({
            columnName: "Issue Category"
        });

        $().SPServices.SPCascadeDropdowns({
            relationshipWebURL: "/",
            relationshipList: "{F35AA9A7-FC4D-4B69-9237-611589D9FC94}",
            relationshipListParentColumn: "Category",
            relationshipListChildColumn: "Title",
            parentColumn: "Issue Category",
            childColumn: "Task",
            simpleChild: true,
         });

        $().SPServices.SPCascadeDropdowns({
            relationshipWebURL: "/",
            relationshipList: "{AE006377-CDEE-435A-9F95-EC74A08785E6}",
            relationshipListParentColumn: "Building",
            relationshipListChildColumn: "Title",
            parentColumn: "Building",
            childColumn: "Room",
            simpleChild: true,
         });
    });
</script>
It is now:
<script type="text/javascript">
    $(document).ready(function (){

        $().SPServices.SPCascadeDropdowns({
            relationshipWebURL: "/",
            relationshipList: "{F35AA9A7-FC4D-4B69-9237-611589D9FC94}",
            relationshipListParentColumn: "Category",
            relationshipListChildColumn: "Title",
            parentColumn: "Issue Category",
            childColumn: "Task",
         });

        $().SPServices.SPCascadeDropdowns({
            relationshipWebURL: "/",
            relationshipList: "{AE006377-CDEE-435A-9F95-EC74A08785E6}",
            relationshipListParentColumn: "Building",
            relationshipListChildColumn: "Title",
            parentColumn: "Building",
            childColumn: "Room",
         });
    });
</script>
This is working which is good, but I am now back to being stuck with complex drop downs. Any ideas why the simple drop downs would cause the wrong item to be saved?

Thanks,

Jon
Coordinator
Aug 26, 2015 at 4:19 PM
Jon:

The trailing commas at the end of your values may be throwing an error:
childColumn: "Room",
If you want simple dropdowns, you need to set
simpleChild: true,
M.
Aug 28, 2015 at 11:52 AM
If I remove the trailing commas at the end of the "childColumn" rows, then the cascading drop down no longer works, it just displays the full list.

Adding simpleChild: true, seems to be what caused the problem. With that not there, the form saves the correct values. As soon as I try using simple child, it reverts back to saving the wrong value.

Thanks for your help so far.