SPWebServices not getting called

Apr 5, 2013 at 3:52 AM
Hi Marc,

I've been trying for days to get this working on dataview form.

Set Up
  1. Custom Master Page
  2. Data View Form
Goal
  1. Expand size of the multiselect column
  2. Arrange choices horizontally
Code

Arrange Choices
<script type="text/javascript" src="https://ts.companyname.com/sites/MSM/Style%20Library/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="https://ts.companyname.com/sites/MSM/Style%20Library/jquery.SPServices-0.7.2.min.js"></script>
<script type="text/javascript"> $(document).ready(function(){ alert("jQuery"); alert($().SPServices.SPGetCurrentSite()); $().SPServices.SPArrangeChoices({ columnName:"Request Type", perRow:6 }); }); </script> Result
In SP arrange choices, I get the message that jquery is loaded as well as the path to the SP site. But nothing happens and there is no error on the page.

Multiselect
<script type="text/javascript" src="https://ts.companyname.com/sites/MSM/Style%20Library/BMW/jquery-1.5.2.min.txt"></script>
<script type="text/javascript" src="https://ts.companyname.com/sites/MSM/Style%20Library/BMW/jquery.SPServices-0.7.2.min.js"></script>
<script type="text/javascript"> $(document).ready(function(){ alert("jQuery is loaded!"); $().SPServices.SPSetMultiSelectSizes({ multiSelectColumn:"Transactions" }); }); </script> Result
Same with MultiSelectSizes, I see the message but nothing happens, no error.

Actions Taken
  • I've added <xsl:comment> trick to both fields just above the SharePointFormField.
  • I've tried only one of the two above at any given time so there are no possibilities of conflict I believe.
  • Also tried the relative URL of the site in the jquery path starting /MSM but no luck.
  • I tried putting both the jquery files on the custom master page to see if that helps but no luck.
  • Removed $(document).ready(function(){ but no luck either.
  • Read almost all of the blogs around this topic but cannot figure out where the problem is.
  • I also added an alert after the SPwebservices call and I could get the alert as well.
I need your advice to please have this working.

Thanks a ton as always,
Srividya
Apr 5, 2013 at 4:01 AM
Hi,

Some more information.

I am using SharePoint 2010 and if it helps, I also tried adding the code on a custom NewForm.aspx with default master and it still did not work.

Thanks,
Srividya
Coordinator
Apr 5, 2013 at 12:10 PM
Srividya:

If you've customized the form with a DVWP, then it's very hard to say what the issue is. Given that you are getting the two alerts, the js references are correct.

Have you tried setting things up on a non-customized version of the form? That's the best place to start. I don't know what other customizations you've needed to do.

M.
Apr 6, 2013 at 6:23 AM
Thank you Marc for your quick response!

I tried it on a non customized form using the default.master and it works. Then I added the non customized form on a page created using my custom master page. It works there as well. So I think the problem is with my DVWP form. It is a basic question but I don't know if the SP services code looks for some kind of class to identify the fields and then do its magic. It apparently finds it on the listview non customized form but does not do it on my DVWP.

Would you please be able to guide?

Regards,
Srividya
Coordinator
Apr 6, 2013 at 11:27 AM
First step is to read the tips on the documentation page.

M.