DFFS Built-in Function Reference – seeking volunteers

Forums Dynamic Forms for SharePoint DFFS Built-in Function Reference – seeking volunteers

This topic contains 6 replies, has 2 voices, and was last updated by  Keith Hudson 2 months, 2 weeks ago.

  • Author
  • #16591

    Keith Hudson

    This is a call for anyone who would like to collaborate on producing a reference showing all the built in functions in DFFS that we can use in our custom JS code. I’m sure Alex could produce one, but I’d like to see if we could start a working group to take that load off Alex and produce at least a draft of such a reference ourselves, then ask Alex to review it/correct it/add to it. I would be glad to host it on a web site if needed, although Alex might be willing to add it somewhere on this site.

    Is anyone interested in having such a reference? Helping build it?

  • #16622

    Alexander Bautz

    Hi Keith,
    Not much response yet, but I hope more people will post their code examples here – I’m sure it will be of great help for others to have a set of examples / references.

    As you know I’m a bit to busy to be able to write it up myself, but I’ll do my best to help out with any questions.

    Thanks for the initiative,

    PS: I made it sticky.

  • #16633

    Keith Hudson

    // get/set field values.
    // NOTE values are read from or written to the input field as strings.
    // On save, they are converted by SP to the right data type
    setFieldValue(‘FIN’ , ‘valueToSet’)

    • This reply was modified 11 months ago by  Keith Hudson. Reason: improve spacing
  • #16640

    Keith Hudson

    //retrieve items from a list
    //takes an object containg the following parameters:
    //listName, query, viewFields

    function getMacros(){
    var fieldName = “Title”;
    var fieldType = “Text”;
    var listName = “Foods”;
    var targetString = getFieldValue(“Food”);
    var qty = getFieldValue(“Qty”);
    var res, qb = [], item;
    qb.push(“<FieldRef Name='” + fieldName + “‘/><Value Type= ‘” + fieldType + “‘>” + targetString + “</Value>” );
    res = spjs_QueryItems({“listName”:listName,”query”:qb.join(“”),”viewFields”:[“PctFat”,”CalTot”,”PctCarb”,”PctProtein”]});
    if(res.count > 0){
    item = res.items[0];
    setFieldValue(“TotCal”,item.CalTot !== null ? item.CalTot*qty: “not set”);
    setFieldValue(“PctFat”,item.PctFat !== null ? item.PctFat*100: “not set”);
    setFieldValue(“PctCarb”,item.PctCarb !== null ? item.PctCarb*100: “not set”);
    setFieldValue(“PctProtein”,item.PctProtein !== null ? item.PctProtein*100: “not set”);

    Forum articles:
    get values from another list/

  • #19322

    Keith Hudson

    Putting Prev/Next tab buttons at the top of the form:

    The easiest way to achieve this is to add this snippet to your custom js. You don’t need to use the Misc settings if you only want the buttons in the top.

    var b = [];
    b.push("<div style='padding:2px;text-align:right;border-bottom: 1px #808080 solid;'>");
    b.push("<input class='ms-ButtonHeightWidth' type='button' value='Previous tab' onclick='spjs.dffs.navTab(0);'>");
    b.push("<input class='ms-ButtonHeightWidth' type='button' value='Next tab' onclick='spjs.dffs.navTab(1);'>");

    (gleaned from http://spjsblog.com/forums/topic/general-dffs-enhancement-suggestions/#post-19314)

    • This reply was modified 3 months ago by  Alexander Bautz. Reason: Wrapped code snippet in <code></code>
  • #19324

    Keith Hudson

    Redirecting user after Save button:

    You can use this code in your custom js:

    The redirect will be performed when saving the form.

    (Gleaned from http://spjsblog.com/forums/topic/general-dffs-enhancement-suggestions/#post-19314)

  • #19602

    Keith Hudson

    You can use this snippet to insert a timestamp in Custom JS:

    spjs.dffs.buildValStr(“{timestamp[dd.MM.yyyy hh:mm:ss]}”);
    // Outputs 03.02.2018 16:27:06

    From http://spjsblog.com/forums/topic/using-timestamp-in-custom-js/

You must be logged in to reply to this topic.