Iv'e had code in production that worked perfectly up until last week. Then without changing anything it started throwing the following error;
__Uncaught Type Error: Cannot call method 'push' undefined__
My platform is SharePoint 2013 online.
I am using the $.fn.SPServices.SPCascadeDropdowns function with two dropdowns the parent being a simple dropdown and the child a multi-select.
I have the following code in a Script Editor webpart on the edit and new item forms on a simple out of the box custom list. ** I exhausted the combinations of jquery and SPServices versions as a troubleshooting method and this is just what I have now.
```
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery.SPServices-2014.01ALPHA1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Lookup Plants",
relationshipListParentColumn: "Market",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "Title",
parentColumn: "Market",
childColumn: "Plant",
debug: true
});
});
</script>
```
After stepping through the code I realized that the code below (line 1398) was not finding the dropdown control on either form. *Again, this exact code was working a couple of days ago.
```
var parentSelect = new DropdownCtl(opt.parentColumn);
```
stepping through some more I see where you are finding the control with this code (line 4090)
```
if ((this.Obj = $("select[Title='" + colName + "']")).length === 1) ...
```
when I check the source of the rendered page in SharePoint I realize the issue.
The title attribute in the select element actually says;
```
title="Market Required Field"
```
So all I had to do is change the parentColumn in config properties of SPCascadeDropdowns
```
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery.SPServices-2014.01ALPHA1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Lookup Plants",
relationshipListParentColumn: "Market",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "Title",
parentColumn: "Market Required Field", <<< Added "Required Field"
childColumn: "Plant",
debug: true
});
});
</script>
```
I am thinking maybe it could be a simple fix just to add an additional check in the if else statement like this?
```
} else if ((this.Obj = $("select[Title='" + colName + " Required Field']")).length === 1) ...
```
I have checked my other versions of SharePoint and none of the titles have the "Required Field" text in them, so I figured this was something new they just release in SharePoint online because I hadn't change a single thing.
I apologize if this is already documented or if this doesn't belong in the issues thread, but I spent a few hours tracking everything down and thought it could help some one else save some time.
Comments: I've got a fix in 2014.01ALPHA2, which I'll post shortly.
__Uncaught Type Error: Cannot call method 'push' undefined__
My platform is SharePoint 2013 online.
I am using the $.fn.SPServices.SPCascadeDropdowns function with two dropdowns the parent being a simple dropdown and the child a multi-select.
I have the following code in a Script Editor webpart on the edit and new item forms on a simple out of the box custom list. ** I exhausted the combinations of jquery and SPServices versions as a troubleshooting method and this is just what I have now.
```
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery.SPServices-2014.01ALPHA1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Lookup Plants",
relationshipListParentColumn: "Market",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "Title",
parentColumn: "Market",
childColumn: "Plant",
debug: true
});
});
</script>
```
After stepping through the code I realized that the code below (line 1398) was not finding the dropdown control on either form. *Again, this exact code was working a couple of days ago.
```
var parentSelect = new DropdownCtl(opt.parentColumn);
```
stepping through some more I see where you are finding the control with this code (line 4090)
```
if ((this.Obj = $("select[Title='" + colName + "']")).length === 1) ...
```
when I check the source of the rendered page in SharePoint I realize the issue.
The title attribute in the select element actually says;
```
title="Market Required Field"
```
So all I had to do is change the parentColumn in config properties of SPCascadeDropdowns
```
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="https://myweburl.com/SiteAssets/js/jquery.SPServices-2014.01ALPHA1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$().SPServices.SPCascadeDropdowns({
relationshipList: "Lookup Plants",
relationshipListParentColumn: "Market",
relationshipListChildColumn: "Title",
relationshipListSortColumn: "Title",
parentColumn: "Market Required Field", <<< Added "Required Field"
childColumn: "Plant",
debug: true
});
});
</script>
```
I am thinking maybe it could be a simple fix just to add an additional check in the if else statement like this?
```
} else if ((this.Obj = $("select[Title='" + colName + " Required Field']")).length === 1) ...
```
I have checked my other versions of SharePoint and none of the titles have the "Required Field" text in them, so I figured this was something new they just release in SharePoint online because I hadn't change a single thing.
I apologize if this is already documented or if this doesn't belong in the issues thread, but I spent a few hours tracking everything down and thought it could help some one else save some time.
Comments: I've got a fix in 2014.01ALPHA2, which I'll post shortly.