Office 365 SharePoint 2013

Jun 10, 2013 at 6:00 PM
Does anyone know if the SPCascadeDropdowns function should work in SharePoint 2013 on Office 365?
I have had great success with this function in the past with on premise SP 2010 but am having some issues getting it to work on Office 365 SP2013.
Coordinator
Jun 11, 2013 at 2:05 AM
It ought to work. What type of issue are you having?

M.
Jun 11, 2013 at 6:46 AM
Edited Jun 11, 2013 at 6:49 AM
Background is:

The relationship list is based on the out of the box Contacts list with a Company Lookup site column added to the Contact content type.

The Company Lookup site column is populated from a custom list called Company list that contains items based on a Company content type.

I have a Projects list that contains a Project content type that has fields Company Lookup and Contact Lookup.

I want to select a Company and have the Contact dropdown filter to only show people from that company.

The code is:
<script type="text/javascript" src="/jquery/jquery-1.7.2.min.js" language="javascript"><span id="ms-rterangecursor-start"></span><span id="ms-rterangecursor-end"></span></script><script type="text/javascript" src="/jquery/jquery.SPServices-2013.01.js" language="javascript"></script><script type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "{CE3E9B95-5D6A-45B7-9D2B-0459F0147E79}",
            relationshipListParentColumn: "Company_x0020_Lookup",
            relationshipListChildColumn: "FullName",
            parentColumn: "Company Lookup",
            childColumn: "Contact Lookup",
            debug: true
        });
    }); </script> 
I started off using jquery 1.8.3 but the debug popup wasn't showing so switched back down to 1.7.2.

The result:

On opening the newform.aspx for Projects the Company Lookup is populated, None is selected and the Contacts Lookup is empty with None selected.

On selecting a Company there is a pause where the JS does it's thing and the dropdown on the Contacts Lookup is frozen. The Contacts Lookup then unlocks but there are no options other then None to be selected.

There are definitely Contacts that have a matching Company although it looks like the script is running and trying to return data but not finding anything.

I have turned debug mode on but don't get any errors.
Coordinator
Jun 12, 2013 at 12:14 AM
It sounds like you're doing everything right. Have you looked at the Net traffic in Firebug or Fiddler?

M.
Jun 12, 2013 at 6:04 AM
Hi Mark,

I had a look at what is going on with Fiddler and each time the parent drop down is changed there is a single request which returns an http 502 with the following message:

DNS Lookup for "_vti_bin" failed. The requested name is valid, but no data of the requested type was found.

Is that something you have seen before or have any ideas about how I can resolve it?

Thanks,

Aidan
Coordinator
Jun 12, 2013 at 11:23 AM
Aidan:

That's odd. That seems to indicate that there's no servername passed in the url for the request. What type of page are you using the call in?

M.
Jun 12, 2013 at 12:24 PM
Hi Mark,

It is newform.aspx. Over https.

The code has been added to a CEWP.

Aidan
Coordinator
Jun 12, 2013 at 7:47 PM
That's pretty ordinary. The only other thing I can spot is that you have a <span> inside your script tag that references jQuery. I don't see how that could matter, but try taking it out.

Have you tried any other SPServices function in this page?

M.
Jun 13, 2013 at 6:26 AM
Hi Mark,

I have got it working by adding relationshipWebURL: "/" to the script.

In my circumstances of Office 365 - SharePoint 2013 it looks like this is required although I have only tested on one Office 365 instance so there may be something else going on.

Anyways, the following works for me:
<script language="javascript" src="/jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
<script language="javascript" src="/jquery/jquery.SPServices-2013.01.js" type="text/javascript"></script><script type="text/javascript">
    $(document).ready(function() {
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "{CE3E9B95-5D6A-45B7-9D2B-0459F0147E79}",
            relationshipWebURL: "/",
            relationshipListParentColumn: "Company_x0020_Lookup",
            relationshipListChildColumn: "FullName",
            parentColumn: "Company Lookup",
            childColumn: "Contact Lookup"
        });
    }); </script>
Thanks for your help.

Aidan
Coordinator
Jun 13, 2013 at 2:24 PM
Ah. If the list is in a different site (web), you do need to specify it. It's not enough to supply the GUID for the list. This is truewhether you're working in Office365 or on premises.

Glad you figured it out!

M.
Jun 20, 2013 at 6:25 PM
Wow, I had to do a couple of steps to get this to work.
1) It appears that without the weburl set SPServicesContext.thisSite returns "" so you get http://_vti_bin which ie flags as cross site scripting.
So even though this is all local to one site and web, weburl is populated.
2) I also had to set matchOnId to true
AND
3) I had to set browser document mode to ![Image] ie8. IE10 and IE9 both hit "SCRIPT5022: NoModificationAllowedError" javascript error when I select the parent dropdown and the child never has any values... any ideas how to avoid that?


<script language="javascript" src="/siteassets/jquery-1.10.1.js" type="text/javascript"></script>
<script language="javascript" src="/siteassets/jquery.SPServices-2013.01.js" type="text/javascript"></script>
<script type="text/javascript"> $().SPServices.SPCascadeDropdowns({ relationshipWebURL: "/", relationshipList: "{B05B6708-CDEE-426A-875A-40ECE06BD093}", relationshipListParentColumn: "Specialty", relationshipListChildColumn: "DoctorName", parentColumn: "Specialty", childColumn: "DoctorLookup", matchOnId: true }); </script>