How add SPServices as a plugin?

Forums Dynamic Forms for SharePoint How add SPServices as a plugin?

Viewing 3 reply threads
  • Author
    Posts
    • #15869
      Keith Hudson
      Participant

      It seems to me that the installation manual used to give instructions on how to add additional plugins such as SPServices to DFFS. However, I am unable to find those instrutions now. (Forgive me if I simply haven’t searched in the right place.) I need to use the SPServices library for a project, so I am currently adding the reference to it in a CEWP on my Default New Form, but I would rather modify my DFFS install so that the SPServices library is available on all my forms that use DFFS.

      Is there a way to add it as a plugin, or must I manually add the reference to one of the DFFS files?

    • #15877
      Alexander Bautz
      Keymaster

      Hi,
      You should be able to load the js file in the top of the Custom JS tab in each form you want to load it in.

      What exactly are you using SPServices for? – There might be functionality in spjs-utility or DFFS that can do the same for your without the need to load an additional file.

      Best regards,
      Alexander

    • #15889
      Keith Hudson
      Participant

      I’m using SPServices GetListItems function to get text contained in another list on my site to display on the form.

      If there is functionality in DFFS to do that already, I would love to use that.

      As far as including SPServices, all I need to do is include a script reference in the Custom JS config page, like this?

      eg http://[url%20to%20SPServices]

    • #15893
      Alexander Bautz
      Keymaster

      Here is a simple example of how you can query another list:

      var res = spjs.utility.queryItems(
          {
              "listName":"The display name or the GUID of the child list",
              "query":"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>YOUR SEARCH STRING</Value></Eq></Where>",
              "viewFields":["ID","Title"]
          }
      );
      
      $.each(res.items,function(i,item){
          console.log(item.Title);
      });

      Add new fields to the “viewFields” array.

      You find more examples by searching from “queryItems” in the forum.

      Regarding the referring a js file in the Custom JS tab:
      Please note that you must have a relatively new DFFS version (don’t remember the exact version) and you will find a separate textarea above the Custom JS where you have a help icon describing the setup.

      If you have an older version of DFFS you can use the jQuery getScript method to load the external js in the Custom JS.

      Alexander

Viewing 3 reply threads
  • You must be logged in to reply to this topic.