how to use spservices framework with fd ?

Discussions about Forms Designer for SharePoint 2010.
Locked
Bruno BICEP
Posts: 6
Joined: Mon Mar 11, 2013

17 Mar 2013

My goal is to use with fd spservices framework, specially $().SPServices.SPCascadeDropdowns function.

It doesn't work?


Someone can help me ?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

18 Mar 2013

Include jquery and spservices library into your master page:

<script language="javascript" type="text/javascript" src="/Style%20Library/SPServices/jquery-1.8.3.min.js"></script>

<script language="javascript" type="text/javascript" src="/Style%20Library/SPServices/jquery.SPServices-0.7.2.min.js"></script>


In Forms Designer's javascript editor use window.$ instead of just $ to use SPServices. Example:

window.$().SPServices.SPCascadeDropdowns({

relationshipList: "Regions",

relationshipListParentColumn: "Country",

relationshipListChildColumn: "Title",

CAMLQuery: "",

parentColumn: "Country",

childColumn: "Region",

debug: true

});


$ is an internal Forms Designer jQuery-library that is included in compatibility mode to prevent conflicts with existing jquery-libraries.

So, you have to include your own jquery library in master-page and use window.$ or jQuery variables.

bburke
Posts: 24
Joined: Fri May 24, 2013

24 May 2013

Added references to jquery and SPServices to the master page. Verified the reference is good..)

Added this to the javascript editor in the new form:


window.$().SPServices.SPLookupAddNew({
lookupColumn: "ClassificationLevel",
promptText: "Add new {0} "
});


This is what fd produced in fd_Item_New.aspx

<script language="javascript" type="text/javascript">//<![CDATA[
var fd_tabcontrol_ids = [];
$fd_jQuery(document).ready(function() {
var $ = $fd_jQuery;
fdInitForm($);
window.$().SPServices.SPLookupAddNew({
lookupColumn: "ClassificationLevel",
promptText: "Add new {0} "
});

});
//]]></script>

Unfortunately it's still not working.... any ideas? Thanks, Bill

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

24 May 2013

Workaround is absolutely the same as for SP2013: viewtopic.php?f=1&t=151#p624

MES5464
Posts: 94
Joined: Mon Aug 26, 2013

01 Oct 2013

Do we still have to add the to the master page? We we still have to uses version 1.9.0?

<script language="javascript" type="text/javascript" src="/Style%20Library/SPServices/jquery-1.8.3.min.js"></script>

<script language="javascript" type="text/javascript" src="/Style%20Library/SPServices/jquery.SPServices-0.7.2.min.js"></script>

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

02 Oct 2013

Forms Designer includes JQuery in compatibility mode, so, you can include any version of JQuery and SPServices you need.

User avatar
schuess
Posts: 82
Joined: Wed Jan 22, 2014

13 Feb 2014

Instead of adding this script tag into the master page, can we use a custom action to deploy a script link?


for example?


<?xml version="1.0" encoding="utf-8"?>

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<CustomAction Location="ScriptLink"

ScriptSrc="~Site/lists/CRR Solution Assets/autoNumeric.js"

Sequence="100"

Id="autoNumeric"

xmlns="http://schemas.microsoft.com/sharepoint/" />

</Elements>

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

14 Feb 2014

Hello,

Sure, you can, but it will be loaded to all pages, not only forms. Also, if this script uses $ or jQuery variables, you have to include your own JQuery library, because as I mentioned above, Forms Designed includes JQuery in compatibility mode, so, these variables are not available globally.

lijupnandanan
Posts: 16
Joined: Mon Apr 11, 2016

12 Apr 2016

Hi,

i tried to get data from a lsi using SPService caml Query. But I got an error like "SPServices error Object doesn't support property or method SPFilterNode" . I referred spservice and jquery min js on master page. Still got this error.

This is my Code


function GetQueryDetAndHide(columnName)
{
alert("Qry Hide");
var thisSite = window.$().SPServices.SPGetCurrentSite().toLowerCase();
alert("Site :"+thisSite);
//thisSite=thisSite.replace("qhse","admin");
var serviceURL = thisSite;
try
{
window.$().SPServices({
operation: "GetListItems",
async: false,
webURL: serviceURL ,
listName: "SettingsList",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='Value' /><Value Type='Lookup'>"+columnName+"</Value></Eq></Where></Query>",
CAMLViewFields: "<ViewFields> <FieldRef Name='Title' /> </ViewFields>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
alert('qry inside remove');
var liHtml = $(this).attr("ows_Title") ;
alert(liHtml);
$("nobr:contains("+liHtml+")").parent('h3').parent('td').parent('tr').hide();
$("#tasksUL").append(liHtml);

});
}
});
}
catch(err)
{
alert(err.message);
}
}

I got the current site url on this but got error on " $(xData.responseXML).SPFilterNode("z:row").each(function()" this session.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

12 Apr 2016


Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests