how to use spservices framework with fd ?
-
- Posts: 6
- Joined: Mon Mar 11, 2013
My goal is to use with fd spservices framework, specially $().SPServices.SPCascadeDropdowns function.
It doesn't work?
Someone can help me ?
It doesn't work?
Someone can help me ?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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.
<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.
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
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
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Workaround is absolutely the same as for SP2013: viewtopic.php?f=1&t=151#p624
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>
<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>
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Forms Designer includes JQuery in compatibility mode, so, you can include any version of JQuery and SPServices you need.
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>
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>
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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.
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.
-
- Posts: 16
- Joined: Mon Apr 11, 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.
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.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests