2

I'd like to modify the Add to list functionality found in SharePoint. The only caveat is that I can't use SharePoint designer, as our site is hosted on Microsoft's servers and they've disabled that functionality.

I've discovered that I can edit the web part for adding items to a specific list by navigating to:

http://mysite/myListName/newForm.aspx?toolpaneview=2

I've inserted a content editor web part and linked it to the following javascript file:

<script src="jquery.min.js"></script>
<script src="jquery.SPServices.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
  $().SPServices.SPCascadeDropdowns({
    relationshipList: "Markets",
    relationshipListParentColumn: "Region",
    relationshipListChildColumn: "Market",
    CAMLQuery: "<Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq>",
    parentColumn: "Region",
    childColumn: "Market",
    debug: true
  });

   alert('hi');
});
</script>

The end goal is to create cascading drop downs, but for now, I'd like just to alert "Hello World" and ensure that jQuery can actually be called from this form? Is it possible? Right now, nothing is happening when I load that page.

I've double checked my script locations, and everything looks good.

Here is what it looks like when I navigate to the above URL:

enter image description here

I would assume that the page would load the Content Editor Web Part just like any other web part. So I am surprised that this is not working. Any advice?

EDIT: Looks like the way I'm coding the path for these scripts is different for a standard web part: enter image description here

2 Answers 2

3

Your file references are wrong if it is giving you a 404 error.

Move them to a document library and give the script the full URL to get it working before making it relative.

Also, the reference to jQuery should come before the reference to SPServices.

0

First of all, move your new web part below the existing entry form as there are API functions within SharePoint that key off of the first web part on a page like this (I wish I was joking). Second, move the alert before the call to SPServices.SPCascadeDropdowns and see if that works. If not, replace $( with jQuery( as it is possible that one of your other libraries is taking control of the $ shortcut.

If that still isn't it, use the Developer Toolbar/Firebug to debug the javascript. Once debugging, it should pop up an error on the line of code that is failing which should help you find the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.