how to use spservices framework with fd ?

rss

Posted by Bruno BICEP - Mar 17 ’13 at 06:58

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

It doesn't work?

 

Someone can help me ?

  • Dmitry
    Dmitry
    Admin
    Member for: 7 years 1 month 6 days
    #1 by Dmitry Mar 18 ’13 at 01:25

    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
    Member
    Member for: 6 years 1 month 23 days
    #2 by bburke May 24 ’13 at 10:00

    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

  • Dmitry
    Dmitry
    Admin
    Member for: 7 years 1 month 6 days
    #3 by Dmitry May 24 ’13 at 02:05
  • MES5464
    Member
    Member for: 5 years 10 months 20 days
    #4 by MES5464 Oct 1 ’13 at 09:29

    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>

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 9 months 26 days
    #5 by Dmitry Kozlov Oct 2 ’13 at 07:27

    [#4]: Forms Designer includes JQuery in compatibility mode, so, you can include any version of JQuery and SPServices you need.

  • schuess
    schuess
    Member
    Member for: 5 years 5 months 23 days
    #6 by schuess Feb 13 ’14 at 04:00

    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>

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 9 months 26 days
    #7 by Dmitry Kozlov Feb 14 ’14 at 04:58

    [#6]: 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
    Member
    Member for: 3 years 3 months 5 days
    #8 by lijupnandanan Apr 12 ’16 at 06:25

    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.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 9 months 26 days
    #9 by Dmitry Kozlov Apr 12 ’16 at 08:10

    [#8]: http://forum.spform.com/forms-designer-for-sharepoint-20/splookupaddnew-39/

Displaying 1 to 9 of 9 messages